question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

resolveFully doesn't resolve nested schemas

See original GitHub issue

I would like to resolve schemas in the following OAS file.

openapi: 3.0.0
info:
  title: std classes
  version: 1.0.0
  contact:
    name: Contact name
    email: contact@mail.com
paths: {}
components:
  schemas:
    MessageCategory:
      type: string
      description: The category describing the severity of the message.
      enum:
        - INFO
        - ERROR
        - WARN
    ResponseMessage:
      type: object
      description: Common response message object.
      required:
        - category
      properties:
        category:
          $ref: "#/components/schemas/MessageCategory"

But if I invoke OpenAPIV3Parser#readLocation() with ParseOptions.resolveFully set to true, category property inside ResponseMessage is not being resolved to the actual object itself. It is still defined as $ref pointing to MessageCategory.

Example of the parsed result, where you can clearly see that the schema wasn’t resolved.

oas-resolve-fully-not-working

Is resolving of schemas intentionally not supported if the OAS file contains schemas only? How can I resolve schema without writing some dummy paths that contain those schemas in request or response? For me it seems obvious that MessageCategory will be resolved inside ResponseMessage if resolveFully is set to true.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
gracekarinacommented, Mar 15, 2021

Hi, @rivancic So I double checked, and the main cause for this to happen id because there are no Paths in the spec, so the resolveFully behaviour is not triggered.

1reaction
gracekarinacommented, Mar 15, 2021

Hi, @rivancic, parser supports resolveFully for references that are not local, as explained here: https://github.com/swagger-api/swagger-parser#2-resolvefully. I will check if it makes sense to add a ParseOption like ResolveFullSchemas or something, to allow the behaviour you need when set to true.

Read more comments on GitHub >

github_iconTop Results From Across the Web

resolveFully doesn't resolve nested references or normal ...
Issue ==> I am using the resolveFully parse option as mentioned in the documentation but seems its not working for most of my...
Read more >
Nesting Schemas — marshmallow 3.19.0 documentation
Schemas can be nested to represent relationships between objects (e.g. foreign key relationships). For example, a Blog may have an author represented by...
Read more >
Nested Schemas template - SAP Help Portal
Use a Nested Schemas template to create a JSON file or an XML file that matches a particular input schema. The Nested Schemas...
Read more >
Automatically Evolve Your Nested Column Schema, Stream ...
MERGE INTO and UPDATE operations now resolve nested struct columns ... the order of the nested columns does not matter (exactly in the...
Read more >
Resolve | webpack
For example, when calling import 'lodash' in ES2015, the resolve options can change ... If multiple files share the same name but have...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found