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

[Meta-issue] Schema library improvements #1

Open
1 task
thehappybug opened this issue Oct 23, 2020 · 0 comments
Open
1 task

[Meta-issue] Schema library improvements #1

thehappybug opened this issue Oct 23, 2020 · 0 comments
Assignees

Comments

@thehappybug
Copy link
Contributor

thehappybug commented Oct 23, 2020

This is a collection of issues and improvements that we need to make to this library.

Documentation

  • 🔴 Add documentation regarding all schema types and their usage.
  • 🔴 Document any polyfills needed by the library.
  • Also, update the package Readme to show the package's goals and objectives.

Features

Some new schema types and other features that we'll probably need later:

  • 🔴 Instance of: check whether the value is an instance of a class. This is blocking the validation of FileWrapper arguments in the SDKs at the moment.
  • Qualifier such as min, max, and probably others. We should look at the OpenAPI and see what cases might occur.

Design

  • ➕ Schema can be redesigned or new schema types created so that the XML-handling code is separated from the schema types. This is important for reducing the size of exported code that only uses this library for JSON mapping and validation which is going to be the majority of the library users.

Tests

  • That for each type is quite repetitive. Test code can be significantly reduced by using Jest "each" runner.
  • Some tests are repeated across types.
  • Tests are missing for certain branches.
  • Tests missing for complex cases. Need integration tests that compose and test schema.

Validation Messages

Error messages can use improvements such as:

  • Report errors found inside property, array elements, or part of other complex types with reference to the complex type.
  • Show errors visually pointed out in the object, dictionary, and array values.
  • Literal can use a simpler error message.
  • XML related errors can show XML formatted data.

TypeScript Typing

  • 🔴 Object schema is hard to extend using "extends" schema when the user is trying to explicitly type the object schema using the "Schema" type. Change "ObjectSchema" to use friendly generic-types. Object inheritance and discriminator work is blocked due to this.
  • Complex schema code skips type-checking in a lot of places by using "any".
  • Review object, dictionary, defaults, discriminator and extends schema types.
  • Let's attempt to write code with 100% type coverage.

Code Quality

  • Setup code coverage metrics.
  • ➕ Discriminator schema requires a review.
  • Code is verbose in schema. For example, nullable and optional are almost the same except for the types. See if we can avoid this repetition.

Tasks

Preview Give feedback
@thehappybug thehappybug self-assigned this Mar 6, 2021
@thehappybug thehappybug changed the title Schema library improvements [Meta-issue] Schema library improvements Mar 29, 2021
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

1 participant