Feature Request - Generate struct name from title
eahrend opened this issue · 0 comments
Hey, I'm currently looking at using this for automating struct generation for some projects I'm working on, and for automation's sake I'd like to be generate the commands to generate these programatically. In this example, schema.json in foo/bot/v1alpha1
references the schema in foo/shaz/alpha1
Ideally I'd like to have something check the files and their parent directory to determine their package/struct names, however in it's current form this will take the schema in foo/shaz/alpha1/schema.json
and name it SchemaJson1
since foo/bot/v1alpha1/schema.json
will be named SchemaJson
, this is because go-jsonschema generates struct names based off of the file names.
.
├── README.md
└── foo
├── shaz
│ └── v1alpha1
│ └── schema.json
├── bot
│ └── v1alpha1
│ └── schema.json
If possible, can we add a flag that creates the struct names from their title?
For example I have a schema like:
{
"$id": "https://github.com/eahrend/foo/shaz",
"description": "A representation of shaz",
"title":"shaz",
"$schema": "http://json-schema.org/draft-06/schema#",
"type":"object",
"properties":{
"key":{
"type":"string"
}
}
I'd like the generator to be able to turn this struct into a struct named shaz:
type Shaz struct {
Key string `json:"key"`
}