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

Need of recursive properties check in validation #372

Open
Jay-Gohil opened this issue Aug 8, 2024 · 0 comments
Open

Need of recursive properties check in validation #372

Jay-Gohil opened this issue Aug 8, 2024 · 0 comments

Comments

@Jay-Gohil
Copy link

Some APIs contain nested schemas, and the current version of 0.7.1 openapi-spec-validator is unable catch the recursive properties. Below is an example of what can be achieved with a little tweak in the class SchemaValidator validation/keywords.py.

 nested_properties = []
        if "allOf" in schema:
            all_of = schema / "allOf"
            while True:
              for inner_schema in all_of:
                  yield from self(
                      inner_schema,
                      require_properties=False,
                  )
                  if "properties" not in inner_schema:
                      continue
                  inner_schema_props = inner_schema / "properties"
                  inner_schema_props_keys = inner_schema_props.keys()
                  nested_properties += list(inner_schema_props_keys)
              if "allOf" not in inner_schema:
                 break
              all_of = inner_schema / "allOf"
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