Skip to content

Code generation #184

@chriskapp

Description

@chriskapp

Hi, Iam currently writing a library which can generate simple classes based on a JsonSchema. Besides validation the library can also read json data and use the generated classes to build an object tree. Similar to JAXB where it is possible to generate classes from a XSD and vice versa.

For the generation the combination keywords allOf, anyOf and oneOf are difficult to handle. To be exact anyOf and oneOf are rather easy since they result always in a single schema but with allOf there are some problems. Since the subschemas must be all applied independently the results are multiple types which can not be merged easily. Iam curious whether/how other devs have solved this problem.

Iam aware that at the moment JsonSchema is mostly about validation but I would like to bring some attention to the code generation process. Maybe we could simplify or clarify this process.

At the OAI spec there is also an interesting issue with some thoughts regarding this topic:
OAI/OpenAPI-Specification#741 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions