api/inventory: remove leaked schemas

This commit is contained in:
Johannes Kirschbauer
2025-08-16 12:20:51 +02:00
parent 2f27b3941e
commit 03968d8fbc
3 changed files with 0 additions and 14 deletions

1
.gitignore vendored
View File

@@ -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

View File

@@ -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" }

View File

@@ -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 {