Content-Length: 260902 | pFad | http://github.com/python-openapi/openapi-spec-validator/issues/372

83 Need of recursive properties check in validation · Issue #372 · python-openapi/openapi-spec-validator · GitHub
Skip to content

Need of recursive properties check in validation #372

Open
@Jay-Gohil

Description

@Jay-Gohil

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"

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









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: http://github.com/python-openapi/openapi-spec-validator/issues/372

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy