networknt / networknt/json-schema-validator

FeatureRequest: WARN log on additional property

Open
#828 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.1k
Forks
352
Avg merge
3d 13h
Merged PRs (30d)
5

Description

Is it possible to add warnings when a property is not included in the schema?
My use case:
Building a data modeling tool built on json-schema, having strict schemas and also using schema composition extensively.
As seen in This issue unevaluatedProperties validates recursively, but additionalProperties does not. When using "allOf" I have to use unevaluatedProperties, but when it is a self-contained schema, we are using additionalProperties=false. This does not apply to any nested object definitions and logging it would help find any instances where a client might use the wrong property name.

Edit: what do you think about a "strict mode" that is configurable so that it fails on addtionalProperties recursively?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no implementation files or tests. Start by reviewing how additionalProperties and unevaluatedProperties are handled, then read issue #826 for the recursive-validation context. Done would require an agreed configurable behavior and corresponding implementation and tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.