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.

Response schema not properly linked

See original GitHub issue

Description When having a OpenAPI 3.0 schema with a response schema, the response schema is not properly linked.

  • - I have checked that my input document is valid OpenAPI 2.0/3.0.x spec

To Reproduce Assuming this OpenAPI definition

components:
  parameters: {}
  schemas:
    FooBodySchema:
      items:
        properties:
          a_field:
            maxLength: 512
            minLength: 1
            type: string
          b_field:
            maxLength: 512
            minLength: 1
            type: string
        required:
        - a_field
        - b_field
        type: object
      type: array

info:
  title: Some API
  version: 1.0.0

openapi: 3.0.0

paths:
  /users:
    post:
      description: 'Imagine all the users living for today ...'
      operationId: users create
      parameters:
      - description: Foo bar
        in: body
        name: body
        required: true
        schema:
          $ref: '#/components/schemas/FooBodySchema'
      responses:
        200:
          description: response for 200 code
          schema:
            $ref: '#/components/schemas/FooBodySchema'
      security:
      - APIKeyHeader: []
      summary: Register user
      tags:
      - Legacy API
    x-extension: value

tags: []

We will get this Markdown part rendered

*Register user*

Imagine all the users living for today ...

<h3 id="users-create-parameters">Parameters</h3>

|Parameter|In|Type|Required|Description|
|---|---|---|---|---|
|body|body|[FooBodySchema](#schemafoobodyschema)|true|Foo bar|

<h3 id="users-create-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|response for 200 code|None|

Expected behavior I would love to see the proper schema linked like so:

*Register user*

Imagine all the users living for today ...

<h3 id="users-create-parameters">Parameters</h3>

|Parameter|In|Type|Required|Description|
|---|---|---|---|---|
|body|body|[FooBodySchema](#schemafoobodyschema)|true|Foo bar|

<h3 id="users-create-responses">Responses</h3>

|Status|Meaning|Description|Schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|response for 200 code|[FooBodySchema](#schemafoobodyschema)|

Screenshots Same thing further processed to Slate, will cause this HTML image (bottom right is the missing schema)

Versions:

  • Node.js: 10.6.0 and 8.0 are similar in results
  • widdershins: 3.6.4

Additional context My commandline is

node_modules/.bin/widdershins \
				--headings 4 \
				--resolve true \
				--search false \
				--language_tabs \
					'shell:Bash' \
					'javascript:JavaScript' \
					'python:Python' \
					'ruby:Ruby' \
					'java:Java' \
				--outfile var/index.html.md \
				--verbose \
				--expandBody true \
				var/openapi_direct.yaml

Any help is appreciated. If I’m doing wrong, please tell me. If this is a bug, maybe you can give some pointers, so I can try to create a PR.

Thanks! 😃

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
mryellowcommented, Apr 12, 2021

Yeah it’s likely I’ll be getting onto this one.

Will finish working up the JSON part of my setup then move onto the markdown/html.

0reactions
MikeRalphsoncommented, Apr 12, 2021

Thank you, much appreciated!

Read more comments on GitHub >

github_iconTop Results From Across the Web

[BUG] Response schema conformance failures are not ...
Describe the bug When validating response conformance, the failures might not be deduplicated which creates a lot of noise.
Read more >
Some Schemas in External Url in $ref do not resolv...
The schema keyword expects a schema definition, but the linked file is not a schema. Here's how you can define a schema for...
Read more >
Describing Responses - Swagger
The schema keyword is used to describe the response body. A schema can define: an object or an array — typically used with...
Read more >
Step 5: Response example and schema (API reference tutorial)
The response example shows a sample response from the request example; the response schema defines all possible elements in the response.
Read more >
Understanding schema errors | HESA
In this version of the error message there has been a code returned, however it does not conform to the schema and is...
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