Is there a way to hide authorization header from OpenAPI 3.1.0 UI, so that I would not need to set a dummy unused value every time?
For the following schema (copy to playground):
openapi: 3.1.0
info:
title: Test
version: 1.0.0
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
schemas: {}
paths:
/user:
post:
requestBody:
content:
application/json:
schema:
type: object
properties:
name:
type: string
required: true
parameters:
- schema:
type: string
in: header
name: authorization
required: true
security:
- bearerAuth: []
responses:
"200":
description: Default Response
Fastify configuration:
import { fastify } from "fastify";
import fs from "@fastify/swagger";
import fsu from "@fastify/swagger-ui";
const app = fastify();
await app.register(fs, {
openapi: {
openapi: "3.1.0",
components: {
securitySchemes: {
bearerAuth: {
type: "http",
scheme: "bearer",
},
},
},
security: [{ bearerAuth: [] }],
},
});
await app.register(fsu);
app.get(
"/",
{
schema: {
headers: {
type: "object",
properties: { authorization: { type: "string" } },
required: ["authorization"],
},
},
},
async (request, reply) => {
return { hello: "world" };
}
);
app
.listen({ port: 3001 })
.then(() => {
console.log("listening");
})
.catch((err) => console.log(err));
Fill the text................................................................................................