-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
Comments
I'd like to work on this if possible. |
Absolutely! Just want to remark that this is just for schemas, not the whole OpenAPI/AsyncAPI document. |
@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? |
Done! |
@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? |
You're totally right :) This way we can leverage existing JSON Schema tooling, which is a lot. |
@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. |
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) {
...
} |
This issue has been automatically marked as stale because it has not had recent activity 😴 |
Create AsyncAPI/OpenAPI schema to JSON Schema Draft 07 converter. It should have a single method as follows:
result
must be a JSON Schema Draft 07-compatible of typejson.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 toexamples
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
The text was updated successfully, but these errors were encountered: