I’m using 5.1.0 to generate our API. A customer has tried to import the resulting openapi.json file into Swagger Editor and has come up with a bunch of validation errors. I’ve seen similar topics in the forum but they all seem to suggest the issue was fixed in 4.9.x.
My DTO is:
[DataContract]
[Route("/candidate", “PUT”, Summary = “Create or update a candidate”)]
public class CandidatePut : IReturn, IProfilePutRequest
{
// Unique to this put
[DataMember]
[ApiMember(Description = “Details of the candidate to update or add”, IsRequired = true)]
[ServiceField(Required = true)]
public Candidate candidate { get; set; }
}
and the Swagger Editor shows:
put:
tags:
- candidate
summary: Create or update a candidate
description: Create or update a candidate
operationId: CandidatePut_Create
consumes:
- application/x-www-form-urlencoded
produces:
- application/json
parameters:
- name: candidate
in: formData
schema:
$ref: ‘#/definitions/Candidate’
description: Details of the candidate to update or add
required: true
- name: body
in: body
schema:
$ref: ‘#/definitions/CandidatePut’
responses:
‘200’:
description: Success
schema:
$ref: ‘#/definitions/CandidatePutResponse’
deprecated: false
parameters:
- $ref: ‘#/parameters/Accept’
and errors of:
Semantic error at paths./candidate.put.parameters
Parameters cannot have both a “in: body” and “in: formData”, as “formData” will be the body
Jump to line 114
Schema error at paths[’/candidate’].put.parameters[0]
should NOT have additional properties
additionalProperty: schema, name, in, description, required
Jump to line 114
Schema error at paths[’/candidate’].put.parameters[0].in
should be equal to one of the allowed values
allowedValues: body, header, query, path
Jump to line 115
Any ideas or hints on what I am missing to generate a valid schema.
TIA
Nic