tdegrunt / jsonschema

JSON Schema validation
Other
1.83k stars 262 forks source link

Tests for TypeScript interface #316

Open awwright opened 4 years ago

awwright commented 4 years ago

Right now, there's no tests that exercise the TypeScript interface. Figure out how to publish tests for this interface, to prevent breakage.

See also: #314 #165 #194 and lots of others

att14 commented 2 years ago

The interface is also not correct. JSONSchema is quite complex, it would probably make more sense to allow any object instead of trying to create a type that can handle any arbitrary schema.

For example, take this meta schema for a JSONSchema. This is a perfectly valid JSONSchema, but cannot be used as type Schema because of multiple issues.

Is it safe to assume that the issues with the type are also not implemented by this library?

att14 commented 2 years ago

Another alternative might be to use the types from https://www.npmjs.com/package/@types/json-schema instead of trying to roll a new one here.

JsonSchema4 type is compatible with this library, but JsonSchema7 is not.

awwright commented 2 years ago

Users have been quite vocal that they use the TypeScript types file for code completion and other things... it shouldn't impact usage at runtime AFAIK.

att14 commented 2 years ago

It doesn't, but you have to add // @ts-ignore everywhere that you use something the type doesn't support.