Skip to content

OpenApi 3.1 contentEncoding: base64url not working #10613

@Louisasa

Description

@Louisasa

Q&A (please complete the following information)

  • OS: macOS
  • Browser: chrome
  • Method of installation: npm
  • Swagger-UI version: v5.29.5
  • Swagger/OpenAPI version: OpenAPI 3.1.0

Content & configuration

Example Swagger/OpenAPI definition:

paths:
  /authorize:
    get:
      summary: Make an authorisation request
      operationId: authorize
      parameters:
        - name: request
          in: query
          required: true
          schema:
            $ref: '#/components/schemas/JWT'

components:
  schemas:
    JWT:
      type: string
      format: jwt
      pattern: '^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$'
      contentEncoding: base64url
      contentSchema:
        type: object
        properties:
          header:
            $ref: '#/components/schemas/JWTHeader'
          payload:
            $ref: '#/components/schemas/JWTPayload'

    JWTHeader:
      type: object
      properties:
        alg:
          type: string
          description: Algorithm used for signing
          example: "HS256"

    JWTPayload:
      type: object
      properties:
        test_id:
          type: string

Describe the bug you're encountering

contentEncoding: base64url causes an issue when I try to expand the parameters of /authorize
I've cloned swagger-ui and ran directly from there so I don't believe it's setup.

To reproduce...

Steps to reproduce the behavior:
Try to open the parameters and get the following error

TypeError: Unknown encoding: base64url
    at Uint8Array.slowToString (swagger-ui-bundle.js:2:380321)
    at Uint8Array.toString (swagger-ui-bundle.js:2:386727)
    at base64url (swagger-ui-bundle.js:2:1459775)
    at Proxy.types_string (swagger-ui-bundle.js:2:1462383)
    at main_sampleFromSchemaGeneric (swagger-ui-bundle.js:2:1472308)
    at Object.main_sampleFromSchema [as sampleFromSchema] (swagger-ui-bundle.js:2:1472553)
    at Object.memoized [as memoizedSampleFromSchema] (swagger-ui-bundle.js:2:406173)
    at Object.getJsonSampleSchema (swagger-ui-bundle.js:2:1473075)
    at swagger-ui-bundle.js:2:1474279
    at Object.getSampleSchema (swagger-ui-bundle.js:2:1389017)

Metadata

Metadata

Assignees

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