mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
feat: add gen:api:clean for clean orval schemas (#6244)
Created a build script that generates orval schemas with automatic cleanup. Also generating new ones. 1. yarn gen:api **(generates schemas)** 2. rm -rf src/openapi/apis **(remove apis)** 3. sed -i '1q' src/openapi/index.ts **(remove all rows except first)**
This commit is contained in:
parent
7a699cf68c
commit
8dc27204d1
@ -32,7 +32,8 @@
|
||||
"e2e:heroku": "NODE_OPTIONS=\"${NODE_OPTIONS} --no-experimental-fetch\" yarn run cypress open --config baseUrl='https://unleash.herokuapp.com' --env AUTH_USER=admin,AUTH_PASSWORD=unleash4all",
|
||||
"gen:api": "NODE_OPTIONS=\"${NODE_OPTIONS} --no-experimental-fetch\" orval --config orval.config.js",
|
||||
"gen:api:demo": "NODE_OPTIONS=\"${NODE_OPTIONS} --no-experimental-fetch\" UNLEASH_OPENAPI_URL=https://app.unleash-hosted.com/demo/docs/openapi.json yarn run gen:api",
|
||||
"gen:api:sandbox": "NODE_OPTIONS=\"${NODE_OPTIONS} --no-experimental-fetch\" UNLEASH_OPENAPI_URL=https://sandbox.getunleash.io/demo2/docs/openapi.json yarn run gen:api"
|
||||
"gen:api:sandbox": "NODE_OPTIONS=\"${NODE_OPTIONS} --no-experimental-fetch\" UNLEASH_OPENAPI_URL=https://sandbox.getunleash.io/demo2/docs/openapi.json yarn run gen:api",
|
||||
"gen:api:clean": "yarn gen:api && rm -rf src/openapi/apis && sed -i '1q' src/openapi/index.ts"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "1.5.1",
|
||||
|
28
frontend/src/openapi/models/getProjectApplicationsParams.ts
Normal file
28
frontend/src/openapi/models/getProjectApplicationsParams.ts
Normal file
@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Generated by Orval
|
||||
* Do not edit manually.
|
||||
* See `gen:api` script in package.json
|
||||
*/
|
||||
|
||||
export type GetProjectApplicationsParams = {
|
||||
/**
|
||||
* The search query for the application name, sdk, environment
|
||||
*/
|
||||
query?: string;
|
||||
/**
|
||||
* The number of applications to skip when returning a page. By default it is set to 0.
|
||||
*/
|
||||
offset?: string;
|
||||
/**
|
||||
* The number of applications to return in a page. By default it is set to 50.
|
||||
*/
|
||||
limit?: string;
|
||||
/**
|
||||
* The field to sort the results by. By default it is set to "createdAt".
|
||||
*/
|
||||
sortBy?: string;
|
||||
/**
|
||||
* The sort order for the sortBy. By default it is det to "asc".
|
||||
*/
|
||||
sortOrder?: string;
|
||||
};
|
@ -632,6 +632,7 @@ export * from './getProjectApiTokens404';
|
||||
export * from './getProjectApplications401';
|
||||
export * from './getProjectApplications403';
|
||||
export * from './getProjectApplications404';
|
||||
export * from './getProjectApplicationsParams';
|
||||
export * from './getProjectDora401';
|
||||
export * from './getProjectDora403';
|
||||
export * from './getProjectDora404';
|
||||
|
@ -38,6 +38,7 @@ import {
|
||||
ProjectApplicationsSchema,
|
||||
} from '../../openapi/spec/project-applications-schema';
|
||||
import { NotFoundError } from '../../error';
|
||||
import { projectApplicationsQueryParameters } from '../../openapi/spec/project-applications-query-parameters';
|
||||
|
||||
export default class ProjectController extends Controller {
|
||||
private projectService: ProjectService;
|
||||
@ -150,6 +151,7 @@ export default class ProjectController extends Controller {
|
||||
summary: 'Get a list of all applications for a project.',
|
||||
description:
|
||||
'This endpoint returns an list of all the applications for a project.',
|
||||
parameters: [...projectApplicationsQueryParameters],
|
||||
responses: {
|
||||
200: createResponseSchema('projectApplicationsSchema'),
|
||||
...getStandardResponses(401, 403, 404),
|
||||
|
@ -0,0 +1,58 @@
|
||||
import { FromQueryParams } from '../util/from-query-params';
|
||||
|
||||
export const projectApplicationsQueryParameters = [
|
||||
{
|
||||
name: 'query',
|
||||
schema: {
|
||||
type: 'string',
|
||||
example: 'first_app',
|
||||
},
|
||||
description:
|
||||
'The search query for the application name, sdk, environment',
|
||||
in: 'query',
|
||||
},
|
||||
{
|
||||
name: 'offset',
|
||||
schema: {
|
||||
type: 'string',
|
||||
example: '50',
|
||||
},
|
||||
description:
|
||||
'The number of applications to skip when returning a page. By default it is set to 0.',
|
||||
in: 'query',
|
||||
},
|
||||
{
|
||||
name: 'limit',
|
||||
schema: {
|
||||
type: 'string',
|
||||
example: '50',
|
||||
},
|
||||
description:
|
||||
'The number of applications to return in a page. By default it is set to 50.',
|
||||
in: 'query',
|
||||
},
|
||||
{
|
||||
name: 'sortBy',
|
||||
schema: {
|
||||
type: 'string',
|
||||
example: 'type',
|
||||
},
|
||||
description:
|
||||
'The field to sort the results by. By default it is set to "appName".',
|
||||
in: 'query',
|
||||
},
|
||||
{
|
||||
name: 'sortOrder',
|
||||
schema: {
|
||||
type: 'string',
|
||||
example: 'desc',
|
||||
},
|
||||
description:
|
||||
'The sort order for the sortBy. By default it is det to "asc".',
|
||||
in: 'query',
|
||||
},
|
||||
] as const;
|
||||
|
||||
export type ProjectApplicationsQueryParameters = Partial<
|
||||
FromQueryParams<typeof projectApplicationsQueryParameters>
|
||||
>;
|
Loading…
Reference in New Issue
Block a user