Skip to content

Add support for collections in OpenApiResponse#566

Merged
cnizzardini merged 2 commits intomasterfrom
collection-schema
Apr 5, 2025
Merged

Add support for collections in OpenApiResponse#566
cnizzardini merged 2 commits intomasterfrom
collection-schema

Conversation

@cnizzardini
Copy link
Copy Markdown
Owner

@cnizzardini cnizzardini commented Apr 5, 2025

Adds support for "collections" in custom response schema, example:

#[OpenApiResponse(schemaType: 'collection', schema: TrimItem::class)]
public function index()

This will output the following OpenAPI YAML:

responses:
  '200':
    description: ''
    content:
      application/json:
        schema:
          properties:
            data:
              items:
                type: object
                properties:
                  your_custom_schema_properties_here:
                    type: string
              type: array
          allOf:
            - $ref: '#/x-swagger-bake/components/schemas/Generic-Collection'

@cnizzardini cnizzardini merged commit 498d33f into master Apr 5, 2025
5 checks passed
@cnizzardini cnizzardini deleted the collection-schema branch April 5, 2025 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant