api/inventory: remove leaked schemas
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -39,7 +39,6 @@ select
|
|||||||
# Generated files
|
# Generated files
|
||||||
pkgs/clan-app/ui/api/API.json
|
pkgs/clan-app/ui/api/API.json
|
||||||
pkgs/clan-app/ui/api/API.ts
|
pkgs/clan-app/ui/api/API.ts
|
||||||
pkgs/clan-app/ui/api/Inventory.ts
|
|
||||||
pkgs/clan-app/ui/api/modules_schemas.json
|
pkgs/clan-app/ui/api/modules_schemas.json
|
||||||
pkgs/clan-app/ui/api/schema.json
|
pkgs/clan-app/ui/api/schema.json
|
||||||
pkgs/clan-app/ui/.fonts
|
pkgs/clan-app/ui/.fonts
|
||||||
|
|||||||
@@ -1,17 +1,10 @@
|
|||||||
import { API } from "@/api/API";
|
import { API } from "@/api/API";
|
||||||
import { Schema as Inventory } from "@/api/Inventory";
|
|
||||||
|
|
||||||
export type OperationNames = keyof API;
|
export type OperationNames = keyof API;
|
||||||
type Services = NonNullable<Inventory["services"]>;
|
|
||||||
type ServiceNames = keyof Services;
|
|
||||||
|
|
||||||
export type OperationArgs<T extends OperationNames> = API[T]["arguments"];
|
export type OperationArgs<T extends OperationNames> = API[T]["arguments"];
|
||||||
export type OperationResponse<T extends OperationNames> = API[T]["return"];
|
export type OperationResponse<T extends OperationNames> = API[T]["return"];
|
||||||
|
|
||||||
export type ClanServiceInstance<T extends ServiceNames> = NonNullable<
|
|
||||||
Services[T]
|
|
||||||
>[string];
|
|
||||||
|
|
||||||
export type SuccessQuery<T extends OperationNames> = Extract<
|
export type SuccessQuery<T extends OperationNames> = Extract<
|
||||||
OperationResponse<T>,
|
OperationResponse<T>,
|
||||||
{ status: "success" }
|
{ status: "success" }
|
||||||
|
|||||||
@@ -96,12 +96,6 @@
|
|||||||
# It treats it not as the type of an empty object, but as non-nullish.
|
# It treats it not as the type of an empty object, but as non-nullish.
|
||||||
# Should be fixed in json2ts: https://github.com/bcherny/json-schema-to-typescript/issues/557
|
# Should be fixed in json2ts: https://github.com/bcherny/json-schema-to-typescript/issues/557
|
||||||
sed -i -e 's/{}/Record<string, never>/g' $out/API.ts
|
sed -i -e 's/{}/Record<string, never>/g' $out/API.ts
|
||||||
|
|
||||||
# Retrieve python API Typescript types
|
|
||||||
# delete the reserved tags from typechecking because the conversion library doesn't support them
|
|
||||||
jq 'del(.properties.tags.properties)' ${self'.legacyPackages.schemas.inventory}/schema.json > schema.json
|
|
||||||
json2ts --input schema.json > $out/Inventory.ts
|
|
||||||
cp ${self'.legacyPackages.schemas.inventory}/* $out
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
clan-lib-openapi = pkgs.stdenv.mkDerivation {
|
clan-lib-openapi = pkgs.stdenv.mkDerivation {
|
||||||
|
|||||||
Reference in New Issue
Block a user