Skip to content

Conversation

@arttuperala
Copy link
Contributor

Description of the Change

Required relationships are added to the required array under relationships in the OpenAPI schema.

    post:
      operationId: create/entries
      requestBody:
        content:
          application/vnd.api+json:
            schema:
              required: ...
              properties:
                data:
                  type: object
                  required: ...
                  properties:
                    type: ...
                    id: ...
                    links: ....
                    attributes: ...
                    relationships:
                      type: object
                      properties:
                        blog:
                          $ref: '#/components/schemas/reltoone'
                        blogHyperlinked:
                          $ref: '#/components/schemas/reltoone'
                        authors:
                          $ref: '#/components/schemas/reltomany'
                        comments:
                          $ref: '#/components/schemas/reltomany'
                        commentsHyperlinked:
                          $ref: '#/components/schemas/reltomany'
                        suggested:
                          $ref: '#/components/schemas/reltomany'
                        suggestedHyperlinked:
                          $ref: '#/components/schemas/reltomany'
                        tags:
                          $ref: '#/components/schemas/reltomany'
                        featuredHyperlinked:
                          $ref: '#/components/schemas/reltoone'
                      required:
                      - blog
                      - authors

Checklist

  • PR only contains one change (considered splitting up PR)
  • unit-test added
  • documentation updated
  • CHANGELOG.md updated (only for user relevant changes)
  • author name in AUTHORS

Copy link
Member

@sliverc sliverc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Looks good.

@sliverc sliverc merged commit 590dbb4 into django-json-api:main Jul 1, 2023
@arttuperala arttuperala deleted the required-relationships branch July 3, 2023 05:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants