fix: swagger documentation authentication (#1037)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Refactor** - Enhanced the API specification generation process to include operation IDs, security schemes, and security definitions more efficiently. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Lucas Smith <me@lucasjamessmith.me>
This commit is contained in:
@@ -2,7 +2,8 @@ import { generateOpenApi } from '@ts-rest/open-api';
|
|||||||
|
|
||||||
import { ApiContractV1 } from './contract';
|
import { ApiContractV1 } from './contract';
|
||||||
|
|
||||||
export const OpenAPIV1 = generateOpenApi(
|
export const OpenAPIV1 = Object.assign(
|
||||||
|
generateOpenApi(
|
||||||
ApiContractV1,
|
ApiContractV1,
|
||||||
{
|
{
|
||||||
info: {
|
info: {
|
||||||
@@ -14,4 +15,21 @@ export const OpenAPIV1 = generateOpenApi(
|
|||||||
{
|
{
|
||||||
setOperationId: true,
|
setOperationId: true,
|
||||||
},
|
},
|
||||||
|
),
|
||||||
|
{
|
||||||
|
components: {
|
||||||
|
securitySchemes: {
|
||||||
|
authorization: {
|
||||||
|
type: 'apiKey',
|
||||||
|
in: 'header',
|
||||||
|
name: 'Authorization',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
security: [
|
||||||
|
{
|
||||||
|
authorization: [],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user