Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Validation of required fields inconsistent #373

Open
@Archelyst

Description

@Archelyst

The validation of therequired keyword does not make sense as it is implemented right now, IMHO.

  1. It really does not make any sense to list properties inrequired that do not exist.
  2. If you want to use it withallOf and therefore have properties inrequired that do not exist, there are already precautions (feat: handle allof when required linked to parent object (#97) #154).
  3. Currently, there is no validation error in the standard case but as soon as I haveallOf in my schema, there is a validation error. That is inconsistent. The PR that breaks it:Allow undefined required properties #312
  4. In$referenced schemas, the validation does not take effect either.

One of the main reasons why this should urgently be validated (as was in version 0.7.0) is that validators (that use the specification to validate requests/responses) will fail if there is e.g. a typo in one of the entries inrequired. And now there is no way to detect that.

In general, the OpenAPI/JsonSchema specification is quite relaxed. If only the bare minimum should be validated, this is probably not the only validation that can basically be removed completely.

My take on this:

  1. Best case: Throw validation errors for things that are obvious errors (like specifying a field as required that does not even exist).
  2. Second best option: make it configurable ("strict mode") or filterable (error IDs to exclude, filter levels, ...).
  3. Absolutely necessary minium: make it consistent.

I'd be willing to provide a PR. But since this has been goingback andforth I'd like a decision first, where this is going.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp