swagger-api / swagger-api/swagger-ui
OpenApi 3.1 contentEncoding: base64url not working
Open
@KrishCodesw is already working on this.
Since Nov 15, 2025.
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
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)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.