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

Support for generating a file per class #163

Open
chrisguiney opened this issue Feb 4, 2022 · 0 comments
Open

Support for generating a file per class #163

chrisguiney opened this issue Feb 4, 2022 · 0 comments

Comments

@chrisguiney
Copy link

It'd be great if I'd be able to generate a file per class without duplicating class definitions --

that is, instead of referencing any classes used for properties in the definitions clause, instead allow referencing them by filename.

For example, see this schema:

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "type": "object",
    "additionalProperties": false,
    "properties": {
        "ReferenceToLocalSchema": {
            "$ref": "#/definitions/LocalType"
        },
        "ReferenceToExternalSchema": {
            "$ref": "Bar.json"
        }
    },
    "definitions": {
        "LocalType": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "no-write": {
                    "type": "boolean",
                    "default": false
                }
            }
        }
    }
}

where Bar.json would be another schema in the same directory.

I'm not incredibly familiar with scala, but I'm happy to give it a shot, if you're open to supporting the feature.

Alternatively, allowing multiple classes to be generated in the same schema without doing something like creating a root class.

My basic use case is that I've got a collection of classes that I'm generating schemas for, and some of them are included in others. This is really frustrating when trying to use a code generator, which will generate the same class multiple times.

Any input/advice welcomed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant