json - Add custom names to AllowedValues -


i have following section of json template file.

"environment": {   "type": "string",   "defaultvalue": "test",   "allowedvalues": [     "development",     "test",     "user acceptance testing",     "load testing",     "stage",     "production"   ] 

when run, display list of environments is. however, want able use see here display names only, once 1 selected, value applied, e.g. production = pdn, load testing = lt.

how write above code?

are using default json-schema? because there no keywords such defaultvalue , allowedvalues in it.

see http://json-schema.org/latest/json-schema-validation.html details.

first of all, purposes should use enum instead of allowedvalues , default instead of defaultvalue, schema like:

"environment": {   "type": "string",   "default": "test",   "enum": [     "development",     "test",     "user acceptance testing",     "load testing",     "stage",     "production"   ] } 

and question, guess kind of processing should implemented in javascript(or using) code, uses json-schema.

so should store "short" versions of environment (like pnd, lt, etc.) schema , full values code. may in localization part of program.

final version of schema:

"environment": {   "type": "string",   "default": "tst",   "enum": [     "dmt",     "tst",     "uat",     "lt",     "stg",     "pnd"   ] } 

Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -