diff --git a/src/lib/blueprint.ts b/src/lib/blueprint.ts index 674db15..5b35903 100644 --- a/src/lib/blueprint.ts +++ b/src/lib/blueprint.ts @@ -8,7 +8,7 @@ import type { } from './openapi.js' export interface Blueprint { - name: string + title: string routes: Route[] resources: Record } @@ -30,7 +30,7 @@ interface Namespace { } interface Endpoint { - name: string + title: string path: string description: string isUndocumented: boolean @@ -114,6 +114,7 @@ interface RecordProperty extends BaseProperty { interface ListProperty extends BaseProperty { type: 'list' } + interface BooleanProperty extends BaseProperty { type: 'boolean' } @@ -135,7 +136,7 @@ export const createBlueprint = ({ openapi }: TypesModule): Blueprint => { const targetSchema = 'acs_system' return { - name: openapi.info.title, + title: openapi.info.title, routes: createRoutes(openapi.paths, isFakeData, targetPath), resources: createResources( openapi.components.schemas, @@ -189,7 +190,7 @@ const createEndpoint = ( const endpointPath = `/${pathParts.slice(1, -1).join('/')}` return { - name: + title: 'operationId' in operation && typeof operation.operationId === 'string' ? operation.operationId : `${path.replace(/\//g, '')}${method.charAt(0).toUpperCase()}${method.slice(1).toLowerCase()}`, diff --git a/test/snapshots/blueprint.test.ts.md b/test/snapshots/blueprint.test.ts.md index 804fc4e..c3b18e8 100644 --- a/test/snapshots/blueprint.test.ts.md +++ b/test/snapshots/blueprint.test.ts.md @@ -9,7 +9,6 @@ Generated by [AVA](https://avajs.dev). > blueprint { - name: 'Foo', resources: { foo: { properties: [ @@ -39,7 +38,6 @@ Generated by [AVA](https://avajs.dev). description: '', isDeprecated: false, isUndocumented: false, - name: 'foosGetGet', parameters: [], path: '/foos', request: { @@ -56,13 +54,13 @@ Generated by [AVA](https://avajs.dev). responseKey: 'foo', responseType: 'resource', }, + title: 'foosGetGet', }, { deprecationMessage: '', description: '', isDeprecated: false, isUndocumented: false, - name: 'foosGetPost', parameters: [], path: '/foos', request: { @@ -79,6 +77,7 @@ Generated by [AVA](https://avajs.dev). responseKey: 'foo', responseType: 'resource', }, + title: 'foosGetPost', }, ], namespace: { @@ -88,4 +87,5 @@ Generated by [AVA](https://avajs.dev). subroutes: [], }, ], + title: 'Foo', } diff --git a/test/snapshots/blueprint.test.ts.snap b/test/snapshots/blueprint.test.ts.snap index 7bc4312..f735260 100644 Binary files a/test/snapshots/blueprint.test.ts.snap and b/test/snapshots/blueprint.test.ts.snap differ diff --git a/test/snapshots/seam-blueprint.test.ts.md b/test/snapshots/seam-blueprint.test.ts.md index 1c47602..24bb644 100644 --- a/test/snapshots/seam-blueprint.test.ts.md +++ b/test/snapshots/seam-blueprint.test.ts.md @@ -9,7 +9,6 @@ Generated by [AVA](https://avajs.dev). > blueprint { - name: 'Seam Connect', resources: { acs_system: { properties: [ @@ -204,7 +203,6 @@ Generated by [AVA](https://avajs.dev). description: '', isDeprecated: false, isUndocumented: false, - name: 'acsSystemsListPost', parameters: [], path: '/acs/systems', request: { @@ -219,6 +217,7 @@ Generated by [AVA](https://avajs.dev). description: 'OK', responseType: 'void', }, + title: 'acsSystemsListPost', }, ], namespace: { @@ -228,4 +227,5 @@ Generated by [AVA](https://avajs.dev). subroutes: [], }, ], + title: 'Seam Connect', } diff --git a/test/snapshots/seam-blueprint.test.ts.snap b/test/snapshots/seam-blueprint.test.ts.snap index 359fcd7..afa2b70 100644 Binary files a/test/snapshots/seam-blueprint.test.ts.snap and b/test/snapshots/seam-blueprint.test.ts.snap differ