Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDK types build: calculate required/optional fields from schema #1321

Merged
merged 2 commits into from
Feb 15, 2024

Conversation

longzheng
Copy link
Contributor

@koush I noticed you added support for required properties in the build.ts but I realised we can actually do this dynamically from the typedoc schema.

In the future we can improve the types even further for function toTypescriptType(type: any): string and function toPythonType(type: any): string { but it was too much trouble so ignoring for now.

@@ -2,12 +2,14 @@ import stringifyObject from 'stringify-object';
import { ScryptedInterface, ScryptedInterfaceDescriptor } from "./types.input";
import path from 'path';
import fs from "fs";
import packageJson from "../package.json"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can import package.json directly instead of using JSON.parse(fs.readFileSync(

@koush koush merged commit f66d39f into koush:main Feb 15, 2024
rustyd0g pushed a commit to rustyd0g/scrypted that referenced this pull request Feb 17, 2024
* Add tsconfig for sdk/types/src

* Get property isOptional from schema

Use typedoc types
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants