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

How to write multiple examples in response body? #837

Closed
1 task done
Hao1995 opened this issue Apr 10, 2024 · 4 comments
Closed
1 task done

How to write multiple examples in response body? #837

Hao1995 opened this issue Apr 10, 2024 · 4 comments
Labels
question Further information is requested

Comments

@Hao1995
Copy link

Hao1995 commented Apr 10, 2024

Scribe version

4.35.0

Your question

I want to add multiple examples to the response bodies. It is mentioned by swagger doc.

responses:
  '200':
    description: A user object.
    content:
      application/json:
        schema:
          $ref: '#/components/schemas/User'   # Reference to an object
        examples:
          Jessica:
            value:
              id: 10
              name: Jessica Smith
          Ron:
            value:
              id: 20
              name: Ron Stewart

Does it work on scribe?

Docs

@Hao1995 Hao1995 added question Further information is requested triage labels Apr 10, 2024
@shalvah
Copy link
Contributor

shalvah commented May 1, 2024

Hey, yes Scribe supports multiple response samples using the "scenario" field. Check out https://scribe.knuckles.wtf/laravel/documenting/responses
But I'm not sure it's exactly handled correctly in OpenAPI, since OpenAPI doesn't let you add descriptions for examples.

@shalvah shalvah removed the triage label May 1, 2024
@Dinushasilva
Copy link

@shalvah @Hao1995 This is introduced in #855

@Hao1995
Copy link
Author

Hao1995 commented May 21, 2024

@shalvah @Hao1995 This is introduced in #855

Thanks your PR!!

@Hao1995 Hao1995 closed this as completed Nov 12, 2024
@shalvah
Copy link
Contributor

shalvah commented Nov 20, 2024

Unfortunately, that PR seems to be abandoned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants