Skip to content

Only generate interfaces for specific definitions #233

Open
@HoldYourWaffle

Description

@HoldYourWaffle

I have a JSON schema file like this:

{
	"$schema": "http://json-schema.org/draft-07/schema#",
	"definitions": {
		
		"MySpecialID": { "type": "number" },
		
		"MySpecialEnum": {
			"enum": [ "some", "interesting", "enum", "values" ],
			"type": "string"
		},
		
		"NonEmptyString": {
			"type": "string",
			"minLength": 1
		},
		
		
		
		"IncomingRequestSchema": {
			"type": "object",
			"properties": {
				"id": { "$ref": "#/definitions/MySpecialID" },
				"name": { "$ref": "#/definitions/NonEmptyString" },
				"type": { "$ref": "#/definitions/MySpecialEnum" },
				"content": { "type": "string" }
			}
		}
		
	}
}

I want to generate a typescript interface only for IncomingRequestSchema. The other types are used and referenced in other places, and for various reasons I don't want them to be generated by this module.

Is this currently possible? If not I'd be willing to add this myself, but I have no idea where I should look.

I'm also getting a interface with the camelCased filename as name with an index type of [k: string]: any;. Can this be disabled?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions