https://linen.dev logo
s

s

07/29/2021, 3:51 PM
@Artem Astapenko just confirming: is this the new expected format for
anyOf
in specs?
Copy code
{
  "prop_name": {
    "type": "object",
    "oneOf": [
      {
        "required": ["option_title"],
        "properties": {
          "option_title": {
            "type": "string",
            "constant": "choice_1"
          }
        }
      },
      {
        "required": [
          "option_title",
          "extra_option_1"
        ],
        "properties": {
          "option_title": {
            "type": "string",
            "constant": "choice_2"
          },
          "extra_option_1": {
            // these are just "normal" JSON Schema type definitions, can be integer, object, they can have "description" and "required" fields etc...
            "title": "Extra Option 1",
            "type": "integer"
          }
        }
      }
    ]
  }
}
also, is a nested oneOf supported?
a

Artem Astapenko

07/29/2021, 7:18 PM
anyOf
? Do not think that we support
anyOf
, probably you mixed it with
oneOf
πŸ™‚
prop_name
should have a type object. This is how prop looked like for postgres
Copy code
"replication_method": {
        "type": "object",
        "title": "Replication Method",
        "description": "Replication method to use for extracting data from the database.",
        "order": 6,
        "oneOf": [
          {
            "title": "Standard",
            "additionalProperties": false,
            "description": "Standard replication requires no setup on the DB side but will not be able to represent deletions incrementally.",
            "required": ["method"],
            "properties": {
              "method": {
                "type": "string",
                "const": "Standard",
                "order": 0
              }
            }
          },
Also note that it should be
const
and not
constant
πŸ‘πŸΌ 1
s

s

07/29/2021, 7:22 PM
sorry, meant
oneOf
a

Artem Astapenko

07/29/2021, 7:29 PM
btw, we also have now support of https://storybook.js.org/docs/react/get-started/introduction I need to add few stories for this form ( ConnectorForm ) and after that you will be able just to open app in dev mode and past the expected schema. After that you will be able to see how it will look like in UI. Not sure if it’s useful for your use case, but I am preparing list of base building blocks and how they are used in app.
s

s

07/29/2021, 7:32 PM
that sounds excellent! It would go really well with the docs in the PR, so the dev can test it out as they are creating the schema
πŸ‘Œ 1
a

Artem Astapenko

07/29/2021, 8:33 PM
As for nested oneOf - in theory it should be supported and as I remember I tested that case.
s

s

07/29/2021, 8:34 PM
oh ok perfect
5 Views