json-schema-to-graphql-types
json-schema-to-graphql-types copied to clipboard
Incorrect names generated
Input:
{
...
"content": {
"properties": {
"content-categories": {
"$ref": "#/definitions/content-categories"
}
}
}
}
Output:
type SampleContent {
content-categories: DefinitionContentCategories
}
The name of the field is invalid, according to https://spec.graphql.org/June2018/#Name
Name
/[_A-Za-z][_0-9A-Za-z]*/
AFAICS, dashes are already converted to underscores for enum values. Probably the same should be done for field names. Or maybe make it configurable whether to use camel-case or lower-cased underscores or something else.
Nice catch! Any chance your usecase is motivating enough to contribute a fix for that? I'm happy to review and merge quickly.