Skip to content
This repository was archived by the owner on Aug 4, 2025. It is now read-only.
This repository was archived by the owner on Aug 4, 2025. It is now read-only.

Create AsyncAPI/OpenAPI schema parser #16

@fmvilas

Description

@fmvilas

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions