Skip to content

Array type has required and properties keyword #2

Description

@karlsson

After parsing the openadr3.yaml using taffy I serialize it to JSON and then feed it to an OpenAPI decoder.
It fails because of required and properties keywords are found in the items section of an array. To my understanding those are reserved for the object type. The parser is for OpenAPI ver. 3.1 but I think this case is valid for 3.0 as well.


One correction is to make the item an object type:

        programDescriptions:
          type: array
          description: A list of programDescriptions
          items:
            object:
            required:
              - URL
            properties:
              URL:
                type: string
                format: uri
                minLength: 2  # see https://www.rfc-editor.org/rfc/rfc3986#appendix-A
                maxLength: 8000
                # see https://www.rfc-editor.org/rfc/rfc7230#section-3.1.1
                # see https://www.rfc-editor.org/rfc/rfc9110#section-4.1-5
                # see also: https://stackoverflow.com/a/417184/6571327
                description: A human or machine readable program description
                example: https://www.myCorporation.com/myProgramDescription
          nullable: true
          default: null

But since it is just one property I guess one could just keep the string part:

        programDescriptions:
          type: array
          description: A list of programDescriptions
          items:
            type: string
            format: uri
            minLength: 2  # see https://www.rfc-editor.org/rfc/rfc3986#appendix-A
            maxLength: 8000
            # see https://www.rfc-editor.org/rfc/rfc7230#section-3.1.1
            # see https://www.rfc-editor.org/rfc/rfc9110#section-4.1-5
            # see also: https://stackoverflow.com/a/417184/6571327
            description: A human or machine readable program description
            example: https://www.myCorporation.com/myProgramDescription
          nullable: true
          default: null

The OpenAPI decoder passes when I make either of these changes.
The issue is valid for version 3.1.1 of OpenADR 3 as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions