-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Timo Glastra <[email protected]>
- Loading branch information
1 parent
d09b153
commit 3f13d05
Showing
22 changed files
with
12,040 additions
and
12,167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { readFile, writeFile } from 'fs/promises' | ||
import { generateSpecAndRoutes } from 'tsoa' | ||
|
||
interface SwaggerJson { | ||
paths: { | ||
[path: string]: { | ||
[method: string]: { parameters?: unknown[]; security?: unknown } | ||
} | ||
} | ||
} | ||
|
||
async function run() { | ||
await generateSpecAndRoutes({}) | ||
|
||
// Modify swagger | ||
const swaggerJson: SwaggerJson = JSON.parse(await readFile('./src/generated/swagger.json', 'utf-8')) | ||
|
||
for (const [path, pathValue] of Object.entries(swaggerJson.paths)) { | ||
for (const [method, methodValue] of Object.entries(pathValue)) { | ||
swaggerJson.paths[path][method] = { | ||
...methodValue, | ||
parameters: [...(methodValue.parameters ?? []), { $ref: '#/components/parameters/tenant' }], | ||
// Removes the security | ||
security: undefined, | ||
} | ||
} | ||
} | ||
|
||
await writeFile('./src/generated/swagger.json', JSON.stringify(swaggerJson, null, 2)) | ||
// eslint-disable-next-line no-console | ||
console.log('Successfully generated spec and routes') | ||
} | ||
|
||
run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
packages/rest/src/controllers/tenants/TenantControllerExamples.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import type { TenantRecord } from './TenantsControllerTypes' | ||
|
||
export const tenantRecordExample: TenantRecord = { | ||
config: { | ||
label: 'Example', | ||
}, | ||
createdAt: new Date('2022-08-18T08:38:40.216Z'), | ||
updatedAt: new Date('2022-08-18T08:38:40.216Z'), | ||
id: '27137142-2e5b-471b-a427-7d5d3fd6d39b', | ||
storageVersion: '0.5', | ||
type: 'TenantRecord', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.