Closed yeralin closed 5 years ago
Addresses #83
Now, a user has an ability to modify JSON schema property name using metadata['name'] parameter.
metadata['name']
Ex., consider the following schema:
class ExampleSchema(Schema): api_token = String(description='API token.')
Resulting JSON schema would look like this:
{ "$ref": "#/definitions/ExampleSchema", "$schema": "http://json-schema.org/draft-07/schema#", "definitions": { "ExampleSchema": { "additionalProperties": false, "properties": { "api_token": { "description": "API token.", "title": "api_token", "type": "string" } }, "type": "object" } } }
If a user desires to modify JSON schema property name (the part "api_token": {), one can simply add name parameter to the schema:
"api_token": {
name
class ExampleSchema(Schema): api_token = String(name='api-token', description='API token.')
Which will yield:
{ "$ref": "#/definitions/ExampleSchema", "$schema": "http://json-schema.org/draft-07/schema#", "definitions": { "ExampleSchema": { "additionalProperties": false, "properties": { "api-token": { <- used metadata['name'] "description": "API token.", "title": "api_token", "type": "string" } }, "type": "object" } } }
Coverage remained the same at 100.0% when pulling 5912cdad53bedd0004b5e1572dc82fc47f6eaa18 on yeralin:modify-json-property-name into b29a8afd11d8eb7f0d34a8ad7de72cf102105a89 on fuhrysteve:master.
Looks alright, had a reason for not merging it @fuhrysteve?
LGTM! Thanks for the pull
Addresses #83
Now, a user has an ability to modify JSON schema property name using
metadata['name']
parameter.Ex., consider the following schema:
Resulting JSON schema would look like this:
If a user desires to modify JSON schema property name (the part
"api_token": {
), one can simply addname
parameter to the schema:Which will yield: