Skip to content

v2.yml Does Not Comply with OpenAPI 3.1.0 #6

@GavynWithLayer

Description

@GavynWithLayer

Here is a compilation of the issues with v2.yml that prevent it from complying with OpenAPI 3.1.0.

Invalid JSON schemas

items

There are 550+ places where a schema has the items field set to an array. This is incorrect for JSON draft 2020-12,
and it should be a single schema value.

Most of the instances look like:

items:
    -   type: string
        example: Invalid email address
        description: Error message
    -   type: object
        example:
            field: email
            message: Invalid email address
        description: Error message

I think the intention is to have this be a oneOf, but I'm not certain.

items:
    -   fieldName:
            description: Form field name
            type: string
            example: First Name
        fieldType:
            description: Form field type
            type: string
            enum:
                - FormTextInput
                - FormTextarea
                - FormCheckboxInput
                - FormRadioInput
                - FormFileUploadInput
            example: FormTextInput
        fieldElementId:
            description: Element ID of the Form Field
            type: string
            format: UUID
            example: 285042f7-d554-dc7f-102c-aa10d6a2d2c4

This one is just a single schema, so it just needs to be un-arrayed.

examples

At paths -> /collections/{collection_id}/items/bulk -> post -> requestBody -> content -> application/json, the schema
has an invalid examples field. It's set to a map, but for JSON schema 2020-12, it should be an array examples. Example
maps are for the higher-up, Open API-specific objects, not JSON schemas.

The offending code:

examples:
    SingleItemMultipleLocales:
        summary: Create a single item across multiple locales
        value:
            cmsLocaleIds:
                - 66f6e966c9e1dc700a857ca3
                - 66f6e966c9e1dc700a857ca4
                - 66f6e966c9e1dc700a857ca5
            isArchived: false
            isDraft: false
            fieldData:
                name: Don’t Panic
                slug: dont-panic
    MultipleItemsMultipleLocales:
        summary: Create multiple items across multipel locales
        value:
            cmsLocaleIds:
                - 66f6e966c9e1dc700a857ca3
                - 66f6e966c9e1dc700a857ca4
            isArchived: false
            isDraft: false
            fieldData:
                -   name: Don’t Panic
                    slug: dont-panic
                -   name: So Long and Thanks for All the Fish
                    slug: so-long-and-thanks

Another instance where this happens is at
webhooks -> collection_item_created -> post -> requestBody -> content -> application/json -> schema:

examples:
    ItemNoLocales:
        triggerType: collection_item_created
        payload:
            id: 580e64008c9a982ac9b8b754
            workspaceId: 625860a7a6c16d624927122f
            siteId: 65427cf400e02b306eaa049c
            collectionId: 664243617fcc8b464b23c4ee
            lastPublished: null
            lastUpdated: '2023-03-17T18:47:35.560Z'
            createdOn: '2023-03-17T18:47:35.560Z'
            isArchived: false
            isDraft: false
            fieldData:
                name: Pan-Galactic Gargle Blaster
                slug: pan-galactic-gargle-blaster
    ItemWithLocales:
        triggerType: collection_item_created
        payload:
            siteId: 65427cf400e02b306eaa049c
            workspaceId: 625860a7a6c16d624927122f
            collectionId: 664243617fcc8b464b23c4ee
            fieldData:
                '0':
                    _cid: 663a4a39d10b271e8f4b38cd
                    _id: 6744b7d0e4ce33f6c3fa789a
                    _locale: 653ad57de882f528b32e810e
                    _draft: false
                    _archived: false
                    name: New Item
                    slug: new-item
                    updated-on: '2024-11-25T17:45:52.447Z'
                    updated-by: Person_63209baeac0b804b455624ce
                    created-on: '2024-11-25T17:45:52.447Z'
                    created-by: Person_63209baeac0b804b455624ce
                    published-on: null
                    published-by: null
                '1':
                    _cid: 663a4a39d10b271e8f4b38cd
                    _id: 6744b7d0e4ce33f6c3fa789a
                    _locale: 653fd9af6a07fc9cfd7a5e5d
                    _draft: false
                    _archived: false
                    name: New Item
                    slug: new-item
                    updated-on: '2024-11-25T17:45:52.447Z'
                    updated-by: Person_63209baeac0b804b455624ce
                    created-on: '2024-11-25T17:45:52.447Z'
                    created-by: Person_63209baeac0b804b455624ce
                    published-on: null
                    published-by: null
                '2':
                    _cid: 663a4a39d10b271e8f4b38cd
                    _id: 6744b7d0e4ce33f6c3fa789a
                    _locale: 654112a3a525b2739d97664f
                    _draft: false
                    _archived: false
                    name: New Item
                    slug: new-item
                    updated-on: '2024-11-25T17:45:52.447Z'
                    updated-by: Person_63209baeac0b804b455624ce
                    created-on: '2024-11-25T17:45:52.447Z'
                    created-by: Person_63209baeac0b804b455624ce
                    published-on: null
                    published-by: null

required

At
paths -> /sites/{site_id}/products/{product_id}/skus -> post -> responses -> 200 -> content -> application/json -> schema -> properties,
there is a required field that I think is supposed to be up a level as a property of the schema itself.

The offending code:

schema:
    type: object
    properties:
        required:
            - skus
        skus:
            type: array
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions