Skip to content

Conversation

tim-lai
Copy link
Contributor

@tim-lai tim-lai commented Sep 19, 2022

Description

Add documentation for OpenAPI 3.1.0 Encoding object

Motivation and Context

Ref: #1991

How Has This Been Tested?

local.

fixture:

openapi: 3.1.0
info:
  title: deref
  version: 1.0.0
components:
  requestBodies:
    sampleEncoding:
      content:
        multipart/form-data:
          schema:
            type: object
            properties:
              id:
                # default is text/plain
                type: string
                format: uuid
              address:
                # default is application/json
                type: object
                properties: {}
              historyMetadata:
                # need to declare XML format!
                description: metadata in XML format
                type: object
                properties: {}
              profileImage: {}
          encoding:
            historyMetadata:
              # require XML Content-Type in utf-8 encoding
              contentType: application/xml; charset=utf-8
            profileImage:
              # only accept png/jpeg
              contentType: image/png, image/jpeg
              headers:
                X-Rate-Limit-Limit:

Screenshots (if appropriate):

parent historyMetadata:

ls-pr-2038-encoding-1

target 1 profileImage.contentType:

ls-pr-2038-encoding-2-target-1

target 2 profileImage.headers:

ls-pr-2038-encoding-3-target-2

Checklist

My PR contains...

  • No code changes (src/ is unmodified: changes to documentation, CI, metadata, etc.)
  • Dependency changes (any modification to dependencies in package.json)
  • Bug fixes (non-breaking change which fixes an issue)
  • Improvements (misc. changes to existing features)
  • Features (non-breaking change which adds functionality)

My changes...

  • are breaking changes to a public API (config options, System API, major UI change, etc).
  • are breaking changes to a private API (Redux, component props, utility functions, etc.).
  • are breaking changes to a developer API (npm script behavior changes, new dev system dependencies, etc).
  • are not breaking changes.

Documentation

  • My changes do not require a change to the project documentation.
  • My changes require a change to the project documentation.
  • If yes to above: I have updated the documentation accordingly.

Automated tests

  • My changes can not or do not need to be tested.
  • My changes can and should be tested by unit and/or integration tests.
  • If yes to above: I have added tests to cover my changes.
  • If yes to above: I have taken care to cover edge cases in my tests.
  • All new and existing tests passed.

@tim-lai
Copy link
Contributor Author

tim-lai commented Sep 19, 2022

Update: moving this comment to own issue here

@char0n I just noticed something with the transform-spec-fragment.js... Using a copy/paste from the raw content, there exists a \|, e.g. [Header Object](#headerObject) \| [Reference Object](#referenceObject)], which gets transformed to \\|. This is fine, and renders as expected in Monaco.

However, there's also usage of | as the html separator for |. e.g. [Header Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#headerObject) | [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#referenceObject)].

Opinions on which or either of them to use? If the former, I can make a pass of existing docs to convert them for consistency's sake. If the latter, I'll update this PR to only use |

@tim-lai tim-lai merged commit 1d59c16 into main Sep 19, 2022
@tim-lai tim-lai deleted the feat/oas31-docs-encoding branch September 19, 2022 18:54
@char0n
Copy link
Contributor

char0n commented Sep 20, 2022

@tim-lai IMHO it doesn't matter. Both character sequences render correctly and are used within the OpenAPI documentation interchangeably.

@tim-lai tim-lai added enhancement New feature or request OpenAPI 3.1 ApiDOM labels Sep 20, 2022
@tim-lai tim-lai self-assigned this Sep 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants