Skip to content

Commit

Permalink
fix: #365 Remove Unused Endponts. (#968)
Browse files Browse the repository at this point in the history
  • Loading branch information
ianliuwk1019 authored Oct 17, 2023
1 parent 3678cdf commit 2976dfc
Show file tree
Hide file tree
Showing 38 changed files with 128 additions and 1,165 deletions.
8 changes: 8 additions & 0 deletions client-code-gen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ With CLI:
>> npm run gen-api
The generated client is located at "./gen" directory specified by the "-o" option at the script.
- Make sure (and adjust) "axios" package version to be consistent with "frontend" axios version.
```

Note:
Expand All @@ -59,7 +61,13 @@ Depending on the Axios version used at frontend, please be aware different axios

```
In some cases, it would be good idea to delete "/gen" directory before running script to regenerate new api client code to avoid leaving unnecessary files from last version generated code.
If you encounter folder permission during npm install or during generation, can issue command to temporarily change `gen` folder and files permission with `chmod -R 777`.
```
### Special Care on openapi.json Spec
* Current openapi(Swagger) spec produced from FastAPI is having issue. Specifically for the "Path" parameter of two endpoints: `"/{application_id}/fam_roles"` and `"/{application_id}/user_role_assignment"`. The path parameter in the produced spec isn't correctly typed (it has "any" type). This, however, only happens on these two endpoints and not on the endpoint that has the same signature `(@router.delete("/{user_role_xref_id}",))`
* We suspect FastAPI version (after we bump up verson to 0.100.0) might be related to this issue. However, we can not downgrade to lower than 0.90.0 and up to today's(2023/10/17) version 0.103.0 does not resolve to correct schema.
* Temporary solution is to add `"type":"integer",` into the corresponding `schema` section of the produced openapi.json manually.
* This is not a desirable behaviour but a temporary solution. So in the future, please verify again with higher FastAPI version and investigate further it further to see if it is fixed.

## How to Use/Integrate with Generated Client/Lib
The generated api client code (under /gen directory) can be used in frontend (located `frontend` folder under project root) as one of its dependencies/libs (currently named it as 'fam-api').
Expand Down
7 changes: 1 addition & 6 deletions client-code-gen/gen/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ api.ts
api/bcscproxy-api.ts
api/famapplications-api.ts
api/famforest-clients-api.ts
api/famroles-api.ts
api/famuser-role-assignment-api.ts
api/famusers-api.ts
api/idirbce-idproxy-api.ts
api/smoke-test-api.ts
base.ts
Expand All @@ -23,20 +21,17 @@ model/fam-forest-client-create.ts
model/fam-forest-client-status-type.ts
model/fam-forest-client-status.ts
model/fam-forest-client.ts
model/fam-role-create.ts
model/fam-role-get.ts
model/fam-role-min.ts
model/fam-role-with-client.ts
model/fam-user-get.ts
model/fam-user-only-name.ts
model/fam-user-role-assignment-create.ts
model/fam-user-role-assignment-get.ts
model/fam-user-type.ts
model/fam-user.ts
model/httpvalidation-error.ts
model/idim-proxy-idir-info.ts
model/index.ts
model/location-inner.ts
model/role-type.ts
model/user-type.ts
model/validation-error.ts
package.json
Expand Down
2 changes: 1 addition & 1 deletion client-code-gen/gen/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.2.1
7.0.1
2 changes: 0 additions & 2 deletions client-code-gen/gen/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
export * from './api/bcscproxy-api';
export * from './api/famapplications-api';
export * from './api/famforest-clients-api';
export * from './api/famroles-api';
export * from './api/famuser-role-assignment-api';
export * from './api/famusers-api';
export * from './api/idirbce-idproxy-api';
export * from './api/smoke-test-api';

6 changes: 4 additions & 2 deletions client-code-gen/gen/api/bcscproxy-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
*/


import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
import { Configuration } from '../configuration';
import type { Configuration } from '../configuration';
import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
import globalAxios from 'axios';
// Some imports not used depending on template conditions
// @ts-ignore
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common';
Expand Down Expand Up @@ -547,3 +548,4 @@ export class BCSCProxyApi extends BaseAPI implements BCSCProxyApiInterface {
return BCSCProxyApiFp(this.configuration).bcscUserinfoTest(options).then((request) => request(this.axios, this.basePath));
}
}

6 changes: 4 additions & 2 deletions client-code-gen/gen/api/famapplications-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
*/


import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
import { Configuration } from '../configuration';
import type { Configuration } from '../configuration';
import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
import globalAxios from 'axios';
// Some imports not used depending on template conditions
// @ts-ignore
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common';
Expand Down Expand Up @@ -307,3 +308,4 @@ export class FAMApplicationsApi extends BaseAPI implements FAMApplicationsApiInt
return FAMApplicationsApiFp(this.configuration).getFamApplicationUserRoleAssignment(applicationId, options).then((request) => request(this.axios, this.basePath));
}
}

6 changes: 4 additions & 2 deletions client-code-gen/gen/api/famforest-clients-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
*/


import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
import { Configuration } from '../configuration';
import type { Configuration } from '../configuration';
import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
import globalAxios from 'axios';
// Some imports not used depending on template conditions
// @ts-ignore
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common';
Expand Down Expand Up @@ -152,3 +153,4 @@ export class FAMForestClientsApi extends BaseAPI implements FAMForestClientsApiI
return FAMForestClientsApiFp(this.configuration).search(clientNumber, options).then((request) => request(this.axios, this.basePath));
}
}

220 changes: 0 additions & 220 deletions client-code-gen/gen/api/famroles-api.ts

This file was deleted.

6 changes: 4 additions & 2 deletions client-code-gen/gen/api/famuser-role-assignment-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
*/


import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
import { Configuration } from '../configuration';
import type { Configuration } from '../configuration';
import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
import globalAxios from 'axios';
// Some imports not used depending on template conditions
// @ts-ignore
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common';
Expand Down Expand Up @@ -234,3 +235,4 @@ export class FAMUserRoleAssignmentApi extends BaseAPI implements FAMUserRoleAssi
return FAMUserRoleAssignmentApiFp(this.configuration).deleteUserRoleAssignment(userRoleXrefId, options).then((request) => request(this.axios, this.basePath));
}
}

Loading

0 comments on commit 2976dfc

Please sign in to comment.