scribe icon indicating copy to clipboard operation
scribe copied to clipboard

How to write multiple examples in response body?

Open Hao1995 opened this issue 2 years ago • 3 comments

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 avatar Apr 10 '24 02:04 Hao1995

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 avatar May 01 '24 09:05 shalvah

@shalvah @Hao1995 This is introduced in https://github.com/knuckleswtf/scribe/pull/855

Dinushasilva avatar May 19 '24 20:05 Dinushasilva

@shalvah @Hao1995 This is introduced in https://github.com/knuckleswtf/scribe/pull/855

Thanks your PR!!

Hao1995 avatar May 21 '24 11:05 Hao1995