Skip to content

Structural error at [property] should be equal to one of the allowed values allowedValues: array, boolean, integer, number, object, string #15

@jziggas

Description

@jziggas

Hello, I was navigating through dndbeyond.com to record API requests and there are many structural errors when importing the resulting JSON into Swagger Editor similar to below:

Structural error at paths./font_picker.post.requestBody.content.application/json.schema.properties.organization_id.type
should be equal to one of the allowed values
allowedValues: array, boolean, integer, number, object, string

This particular request looks like:

curl 'https://echidna.wirewax.com/font_picker' \
  -H 'accept: */*' \
  -H 'accept-language: en-US,en;q=0.9' \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json' \
  -H 'origin: https://player.vimeo.com' \
  -H 'pragma: no-cache' \
  -H 'referer: https://player.vimeo.com/' \
  -H 'sec-ch-ua: "Google Chrome";v="123", "Not:A-Brand";v="8", "Chromium";v="123"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "macOS"' \
  -H 'sec-fetch-dest: empty' \
  -H 'sec-fetch-mode: cors' \
  -H 'sec-fetch-site: cross-site' \
  -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36' \
  --data-raw '{"environment":"player","organization_id":null}'

The resulting OpenAPI request body looks like:

requestBody:
       content:
         application/json:
           schema:
             type: object
             properties:
               environment:
                 type: string
               organization_id:
                 type: 'null'
             required:
               - environment
               - organization_id

As you can see null is not the same as 'null'. When submitting a value of null it's probably not possible to determine what the type signature should be. But rather than a string of 'null' it should probably just be an empty string to or one of the other allowed values to adhere to the spec.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions