Swagger-php: Reference definition but exclude certain fields

Created on 4 Apr 2018  路  2Comments  路  Source: zircote/swagger-php

Is there a way to use a definition reference but exclude certain fields from it? For example, I have a definition for a model, which includes things like id, name, description, but when defining the schema for my POST route to create this resource, I don't want id to be included. Am I forced to manually recreate the definition?

Most helpful comment

It looks like this is an "old" issue and might be implemented in the future.
But I would like to use exclude={"id"} too :)

All 2 comments

It looks like this is an "old" issue and might be implemented in the future.
But I would like to use exclude={"id"} too :)

Sadly you can't exclude properties sometimes, you'll need to create 2 definitions per model. one with the id and one without.

You can reuse the ThingWithoutId annotation inside the ThingWithId by using the allOf composition

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aqlx86 picture aqlx86  路  3Comments

kamil-kielczewski picture kamil-kielczewski  路  3Comments

Dalabad picture Dalabad  路  4Comments

ricardovanlaarhoven picture ricardovanlaarhoven  路  5Comments

DerManoMann picture DerManoMann  路  3Comments