Hi, you can certainly have different models for `POST` and `PUT`, however, they 
will be just that—different models.  I suggest you take the most lenient model 
(say, the one with no required fields) and use the “allOf” construct to merge 
that model with the required array.  Like this:

  Pet:
    type: object
    properties:
      id:
        type: string
      name:
        type: string
  PetResponse:
    type: object
    allOf:
    - $ref: '#/definitions/Pet'
    - type: object
      required:
      - id
      - name

> On Sep 5, 2016, at 9:33 AM, silverdals <[email protected]> wrote:
> 
> Hi,
> 
> I am wondering if it's possible to have two api's share an api model class 
> and document that api model differently based on POST vs PUT ?
> 
> For example, lets say we have "POST /pets" & "PUT /pets" api's which both 
> consume the same class Pet. I would like to specify the pets name field has 
> required for the POST but optional for the PUT. is the only way of achieving 
> this to have separate models per api ?
> 
> Thanks for the help,
> Sam. 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Swagger" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to