json-schema-form icon indicating copy to clipboard operation
json-schema-form copied to clipboard

add basic support for allOf

Open aeberhart opened this issue 4 years ago • 0 comments

the form should work with auto-generated schemata like this example:

{
    type: 'array',
    items: {
      $ref: '#/definitions/ModelConfig'
    },
    title: 'Model Config',
    default: {
      top_p: 1.0,
      engine: 'curie',
      max_tokens: 60,
      temperature: 0.3
    },
    definitions: {
      EngineTypes: {
        enum: ['curie', 'davinci', 'babbage', 'ada'],
        type: 'string',
        title: 'EngineTypes',
        description: 'The engine to use for API request',
        default: 'curie'
      },
      ModelConfig: {
        type: 'object',
        title: 'ModelConfig',
        properties: {
          top_p: {
            type: 'number',
            title: 'Top P',
            default: 1.0,
            maximum: 1,
            minimum: 0,
            description: 'Controls diversity'
          },
          engine: {
            allOf: [
              {
                $ref: '#/definitions/EngineTypes'
              }
            ]
          },
          max_tokens: {
            type: 'integer',
            title: 'Max Tokens',
            default: 60,
            maximum: 1024,
            description: 'The maximum number of tokens to generate'
          },
          temperature: {
            type: 'number',
            title: 'Temperature',
            default: 0.3,
            maximum: 1,
            minimum: 0,
            description:
              'Controls randomness:Lowering results in less random results'
          }
        }
      }
    }
  };

allOf only refers to a single subschema and can be ignored in this case

aeberhart avatar Jun 04 '21 06:06 aeberhart