Skip to content

Commit

Permalink
Add missing OAS related opts
Browse files Browse the repository at this point in the history
  • Loading branch information
ardatan committed May 5, 2023
1 parent cd2a801 commit 61e0494
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/purple-worms-care.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'sofa-api': patch
---

Add missing options for OAS
5 changes: 4 additions & 1 deletion src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,13 @@ export function createRouter(sofa: Sofa) {

const router = createRouterInstance<any>({
base: sofa.basePath,
components,
title: sofa.title || 'SOFA API',
description: sofa.description || 'Generated by SOFA',
version: sofa.version || '0.0.0',
components,
oasEndpoint: sofa.oasEndpoint,
swaggerUIEndpoint: sofa.swaggerUIEndpoint,
swaggerUIOpts: sofa.swaggerUIOpts,
});

const queryType = sofa.schema.getQueryType();
Expand Down
13 changes: 11 additions & 2 deletions src/sofa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { convertName } from './common';
import { logger } from './logger';
import { ErrorHandler } from './router';
import { HTTPMethod, StatusCode } from 'fets/typings/typed-fetch';
import { SwaggerUIOpts } from 'fets/typings/plugins/openapi';

// user passes:
// - schema
Expand Down Expand Up @@ -55,9 +56,13 @@ export interface SofaConfig {
context?: ContextFn | ContextValue;
customScalars?: Record<string, any>;
enumTypes?: Record<string, any>;
// OAS Related Settings
title?: string;
version?: string;
description?: string;
version?: string;
oasEndpoint?: string | false;
swaggerUIEndpoint?: string | false;
swaggerUIOpts?: SwaggerUIOpts;
}

export interface Sofa {
Expand All @@ -73,9 +78,13 @@ export interface Sofa {
contextFactory: ContextFn;
customScalars: Record<string, any>
enumTypes: Record<string, any>
// OAS Related Settings
title?: string;
version?: string;
description?: string;
version?: string;
oasEndpoint?: string | false;
swaggerUIEndpoint?: string | false;
swaggerUIOpts?: SwaggerUIOpts;
}

export function createSofa(config: SofaConfig): Sofa {
Expand Down

0 comments on commit 61e0494

Please sign in to comment.