Skip to content

Fields with oneOf tag are not displayed #112

Open
@kventos

Description

@kventos

Hi!

I have a problem with form generating with properties containing oneOf tag. I tried to convert JSON with this peace on the demo converter site here and got only field name with empty text field which cannot be submitted.

What should I do for correct work?

"SomeProperty" : {
        "type" : "object",
        "description" : "Some property description",
        "oneOf" : [ {
            "properties" : {
                "PropertyType" : {
                    "type" : "string",
                    "description" : "Property type description",
                    "enum" : [ "firstValue", "secondValue" ]
                },
                "PropertyValue" : {
                    "type" : "string",
                    "minLength" : 1,
                    "description" : "Property value description"
                }
            },
            "required" : [ "PropertyType", "PropertyValue" ],
            "additionalProperties" : false
        }, {
            "properties" : {
                "PropertyType" : {
                    "type" : "string",
                    "description" : "Property type description",
                    "enum" : [ "thirdValue", "forthValue" ]
                },
                "PropertyValue" : {
                    "type" : "string",
                    "minLength" : 1,
                    "description" : "Property value description",
                    "pattern" : "^[A-Z]{2}[A-Z0-9]{9}[0-9]$"
                }
            },
            "required" : [ "PropertyType", "PropertyValue" ],
            "additionalProperties" : false
        } ]
      }

Whole JSON

{
  "schema": {
    "type": "object",
    "properties": {
      "first_name": { "type": "string" },
      "last_name": { "type": "string" },
      "address": {
        "type": "object",
        "properties": {
          "street_1": { "type": "string" },
          "street_2": { "type": "string" },
          "city": { "type": "string" },
          "state": {
            "type": "string",
            "enum": [ "AL", "AK", "AS", "AZ", "AR", "CA", "CO", "CT", "DE",
                "DC", "FM", "FL", "GA", "GU", "HI", "ID", "IL", "IN", "IA",
                "KS", "KY", "LA", "ME", "MH", "MD", "MA", "MI", "MN", "MS",
                "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND",
                "MP", "OH", "OK", "OR", "PW", "PA", "PR", "RI", "SC", "SD",
                "TN", "TX", "UT", "VT", "VI", "VA", "WA", "WV", "WI", "WY" ]
          },
          "zip_code": { "type": "string" }
        }
      },
      "birthday": { "type": "string" },
      "notes": { "type": "string" },
      "phone_numbers": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "number": { "type": "string" },
            "type": {
              "type": "string",
              "enum": [ "cell", "home", "work" ]
            }
          },
          "required": [ "number", "type" ]
        }
      },
      "SomeProperty" : {
        "type" : "object",
        "description" : "Some property description",
        "oneOf" : [ {
            "properties" : {
                "PropertyType" : {
                    "type" : "string",
                    "description" : "Property type description",
                    "enum" : [ "firstValue", "secondValue" ]
                },
                "PropertyValue" : {
                    "type" : "string",
                    "minLength" : 1,
                    "description" : "Property value description"
                }
            },
            "required" : [ "PropertyType", "PropertyValue" ],
            "additionalProperties" : false
        }, {
            "properties" : {
                "PropertyType" : {
                    "type" : "string",
                    "description" : "Property type description",
                    "enum" : [ "thirdValue", "forthValue" ]
                },
                "PropertyValue" : {
                    "type" : "string",
                    "minLength" : 1,
                    "description" : "Property value description",
                    "pattern" : "^[A-Z]{2}[A-Z0-9]{9}[0-9]$"
                }
            },
            "required" : [ "PropertyType", "PropertyValue" ],
            "additionalProperties" : false
        } ]
      }
    }
  }
}

screen

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions