Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create AsyncAPI/OpenAPI schema parser #16

Open
2 tasks
fmvilas opened this issue Mar 6, 2019 · 9 comments
Open
2 tasks

Create AsyncAPI/OpenAPI schema parser #16

fmvilas opened this issue Mar 6, 2019 · 9 comments
Labels
help wanted Extra attention is needed keep-open

Comments

@fmvilas
Copy link
Member

fmvilas commented Mar 6, 2019

Create AsyncAPI/OpenAPI schema to JSON Schema Draft 07 converter. It should have a single method as follows:

.Parse(schema []byte) (result json.RawMessage, error)

result must be a JSON Schema Draft 07-compatible of type json.RawMessage.

Implementation suggestion

We could create this library separated from the parser so other projects can benefit from it too.

Differences between OpenAPI/AsyncAPI schemas and JSON Schema Draft 07 schemas

  • nullable: Must translate to type array, e.g., "type": ["string", null]
  • discriminator: Must be removed or ignored, i.e., it must not be included in the JSON Schema Draft 07 schema. There's not strong opinion here, so if you prefer to just keep it, it would be just fine too.
  • xml: Should remain the same as in OpenAPI schema.
  • externalDocs: Should remain the same as in OpenAPI schema.
  • example: Should be renamed to examples and be of type array.
  • deprecated: Should remain the same as in OpenAPI schema.
  • readOnly: Should remain the same as in OpenAPI schema.
  • writeOnly: Should remain the same as in OpenAPI schema.

References

  • 🐛 Unit tests
  • 📚 Documentation
@fmvilas fmvilas added this to the Milestone 1 milestone Mar 6, 2019
@fmvilas fmvilas added the help wanted Extra attention is needed label Mar 6, 2019
@RobertDiebels
Copy link

I'd like to work on this if possible.

@fmvilas
Copy link
Member Author

fmvilas commented Mar 14, 2019

Absolutely! Just want to remark that this is just for schemas, not the whole OpenAPI/AsyncAPI document.

@RobertDiebels
Copy link

RobertDiebels commented Mar 15, 2019

@fmvilas Great :D ! Alright, I'll have a look at the repo you linked this weekend. If I have any questions I'll let you know. Also, could you assign the issue to me?

@fmvilas
Copy link
Member Author

fmvilas commented Mar 16, 2019

Done!

@RobertDiebels
Copy link

@fmvilas I've read the documentation in the repository you linked. Am I right in concluding the aim is to parse an AsyncAPI-spec and convert it to a JSON-schema so other software can use the JSON-schema to validate incoming/outgoing messages?

@fmvilas
Copy link
Member Author

fmvilas commented Mar 17, 2019

You're totally right :)

This way we can leverage existing JSON Schema tooling, which is a lot.

@RobertDiebels
Copy link

@fmvilas I might take a bit longer to get this fixed. I'm on developing on Windows and I'm encountering some issues when compiling the code-base to C. I'm currently looking for a solution that doesn't involve to much hassle.

@fmvilas
Copy link
Member Author

fmvilas commented Mar 23, 2019

I'd forget about the parser and would do it as a separate library/repo. You don't need the rest of the parser nor compiling it to C to make it work.

Make it simpler and go for a simple Go library that takes a byte array and returns a json.RawMessage and error:

func Parse(protobufSchema []byte) (json.RawMessage, error) {
  ...
}

See more here: https://github.com/asyncapi/parser/blob/master/TECHNICAL%20PROPOSAL.md#api-of-a-specific-schema-parser-instance-eg-protobuf-schema-parser

@RobertDiebels RobertDiebels removed their assignment Apr 3, 2019
@fmvilas fmvilas self-assigned this Apr 3, 2019
@fmvilas fmvilas removed their assignment Jun 25, 2019
@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity 😴
It will be closed in 30 days if no further activity occurs. To unstale this issue, add a comment with detailed explanation.
Thank you for your contributions ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed keep-open
Projects
None yet
Development

No branches or pull requests

3 participants