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

Define TypeScript schema for responses #685

Open
marcoscaceres opened this issue Aug 19, 2021 · 6 comments
Open

Define TypeScript schema for responses #685

marcoscaceres opened this issue Aug 19, 2021 · 6 comments

Comments

@marcoscaceres
Copy link
Collaborator

It be nice to have a TypeScript types file, for APIs that consume this.

(I've not had a chance to do something like this before, but would be useful for projects like ReSpec that consume this data)

CC'ing @saschanaz who may provide guidance? 🙏

I think what we need is described in:
https://www.typescriptlang.org/docs/handbook/declaration-files/templates/module-d-ts.html

@saschanaz
Copy link

I haven't seen a type scheme defined without an actual library. Might be interesting to see an existing case.

@marcoscaceres
Copy link
Collaborator Author

I'm thinking of something like:
https://www.npmjs.com/package/@types/pluralize

Where the types are delivered independently of the actual library.

I guess then also specref itself would also use them - though it's not really a library in the traditional sense.

@saschanaz
Copy link

That corresponds to the actual library named pluralize. Anyway there is @types/node which is obviously not a library and also @types/web-ie11, so probably doable.

@saschanaz
Copy link

BTW I think getting a JSON schema file would probably be better for multiple language support 👀

@tobie
Copy link
Owner

tobie commented Sep 17, 2021

Like these?

@saschanaz
Copy link

Oh cool. Maybe use things like https://www.npmjs.com/package/json-schema-to-typescript to generate TypeScript lib then?

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

No branches or pull requests

3 participants