We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
based on the following JSONSchema I would like to propose the generation of a New() function.
{ "definitions": {}, "$schema": "http://json-schema.org/draft-07/schema#", "$id": "http://example.com/root.json", "type": "object", "title": "The Root Schema", "required": [ "type", "data" ], "properties": { "type": { "$id": "#/properties/type", "type": "string", "title": "Type", "default": "notify_event", "examples": [ "notify_event" ], "pattern": "^(.*)$" }, "data": { "$id": "#/properties/data", "type": "object", "title": "Data", "required": [ "resourceId", "type", "title", "content" ], "properties": { "resourceId": { "$id": "#/properties/data/properties/resourceId", "type": "string", "title": "Resourceid", "default": "", "examples": [ "1a2s3d4f" ], "pattern": "^(.*)$" }, "type": { "$id": "#/properties/data/properties/type", "type": "string", "title": "Type", "default": "rule", "examples": [ "rule" ], "pattern": "^(.*)$" }, "title": { "$id": "#/properties/data/properties/title", "type": "string", "title": "Title", "default": "", "examples": [ "rule violation" ], "pattern": "^(.*)$" }, "content": { "$id": "#/properties/data/properties/content", "type": "string", "title": "Content", "default": "", "examples": [ "some explaination about rule violation" ], "pattern": "^(.*)$" } } } } }
Proposed Output:
package main // generated by "schematyper schema.json" -- DO NOT EDIT const ( defaultType string = "notify_event" defaultDataType string = "rule" ) type schema struct { Data theData `json:"data"` Type string `json:"type"` } type data struct { Content string `json:"content"` Resourceid string `json:"resourceId"` Title string `json:"title"` Type string `json:"type"` } func NewSchema() *schema { return &schema{ Data: data{ Content: "", Resourceid: "", Title: "", Type: defaultDataType, }, Type: defaultType, } } func NewData() *data { return &data{ Content: "", Resourceid: "", Title: "", Type: defaultDataType, } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
based on the following JSONSchema I would like to propose the generation of a New() function.
Proposed Output:
The text was updated successfully, but these errors were encountered: