I’m using http://editor.swagger.io to design an API and I get an error which I don’t know how to address:
Schema error at paths['/employees/{employeeId}/roles'].get.parameters[0]
should NOT have additional properties
additionalProperty: type, format, name, in, description
Jump to line 24
I have other endpoints defined in a similar way, and don’t get this error. I wondered if I had some issue with indentation or unclosed quotes, but that doesn’t seem to be the case. Google also did not seem to provide any useful results.
swagger: "2.0"
info:
description: Initial draft of the API specification
version: '1.0'
title: App 4.0 API
host: api.com
basePath: /v1
tags:
- name: employees
description: Employee management
schemes:
- https
paths:
/employees/{employeeId}/roles:
get:
tags:
- employees
summary: "Get a specific employee's roles"
description: ''
operationId: findEmployeeRoles
produces:
- application/json
parameters:
- name: employeeId <====== Line 24
in: path
description: Id of employee whose roles we are fetching
type: integer
format: int64
responses:
'200':
description: successful operation
schema:
type: array
items:
$ref: '#/definitions/Role'
'403':
description: No permission to see employee roles
'404':
description: EmployeeId not found
Any Hints?
Helen
84.7k16 gold badges235 silver badges300 bronze badges
asked Aug 7, 2017 at 14:43
The error message is misleading. The actual error is that your path parameter is missing required: true
. Path parameters are always required, so remember to add required: true
to them.
answered Aug 7, 2017 at 15:01
HelenHelen
84.7k16 gold badges235 silver badges300 bronze badges
2
Had the same problem. I accidentally mixed up the syntax from Swagger 2.0
with Openapi 3.0.x
. In Openapi 3.0.x
, definitions are redefined as components. In the online editor you can click on the button Edit > Convert to OpenAPI 3 to use Openapi 3.0.x
.
Read more about components here.
Remark:
OAS 3 is the latest version of the
OpenAPI Specification.
answered Dec 6, 2019 at 9:54
Ri1aRi1a
7368 silver badges25 bronze badges
2
For me the cause of the error was a missing a leading slash in the path (internal/resource
instead of /internal/resource
).
And yes the error message is extremely unhelpful.
answered Feb 14, 2022 at 9:42
In my case I was missing parameter definition in api definition
- name: parameterName
in: query
description: parameter's description here.
required: false
schema:
type: string
answered Sep 9, 2021 at 18:13
Farooq HanifFarooq Hanif
1,7491 gold badge15 silver badges21 bronze badges
In my case it had the wrong indentation for the example. It was:
content:
application/json:
schema:
$ref: '#/components/schemas/someresponse'
examples:
example1:
value:
param1: "some string"
param2: "123"
Rather than:
content:
application/json:
schema:
$ref: '#/components/schemas/someresponse'
examples:
example1:
value:
param1: "some string"
param2: "123"
But the VScode open api preview with swaggerUI didn’t show any errors and everything looked valid.
answered Jul 5, 2022 at 21:37
TxugoTxugo
5,0085 gold badges33 silver badges40 bronze badges
The syntax requires might require two parameters, as mentioned by Helen required: true
is need so is type:DataType
. The error is misleading.
answered Feb 13, 2019 at 6:09
Hi all. We have this issue and we cannot get it solved. Googling didn’t help.
We’re developing a Java rest service using Spring MVC and we have following endpoint:
@ApiOperation(value = "Get doc for entity by specified UUID")
@GetMapping("{uuid}/doc")
public ResponseEntity<?> getEntityDoc(
@PathVariable UUID uuid,
@RequestParam Map<String, String> queryParams,
@RequestParam UUID token) {
Swagger editor shows this endpoint description properly, but reports error:
chema error at paths['/entities/{uuid}/doc'].get.parameters[1]
should NOT have additional properties
additionalProperty: items, name, in, description, required
Jump to line 1630
Schema error at paths['/entities/{uuid}/doc'].get.parameters[1].in
should be equal to one of the allowed values
allowedValues: body, header, formData, path
Jump to line 1631
Schema error at paths['/entities/{uuid}/doc'].get.parameters[1].items
should NOT have additional properties
additionalProperty: additionalProperties
Jump to line 1634
Schema error at paths['/entities/{uuid}/doc'].get.parameters[1].items.type
should be equal to one of the allowed values
allowedValues: string, number, integer, boolean, array
Jump to line 1635
openapiswagger-editorvalidationyaml
What does this error below mean? (Running in Swagger Editor)
Schema error should NOT have additional properties additionalProperty:
/buildinfo, /clearcache,
/countries/{countryId}/cinemas/{theatreid}/screens/{screenid}/layout,
/countries/{countryId}/cinemas/{theatreid}/screens Jump to line 0
Below is my yaml file.
openapi: "3.0.1"
info:
title: Mobile backend
version: 1.0.0
license:
name: Apache 2.0
paths:
/buildinfo:
get:
description: Returns the build information (Version and Time stamp).
operationId: getBuildInfo
parameters:
- name: LBPATH
in: header
/clearcache:
get:
description: Clears the mobile backends cache (You need to be Admin to do this call)
operationId: clearCache
parameters:
- name: LBPATH
in: header
/countries/{countryId}/cinemas/{theatreid}/screens/{screenid}/layout:
get:
description: Returns a list of Auditoriums that is currently running in a specific city. Ordered by movie name in ascending order.
operationId: getScreenLayout
parameters:
- name: theatreid
in: path
- name: screenid
in: path
- name: seatwidth
in: query
- name: seatheight
in: query
- name: Accept-Language
in: header
- name: LBPATH
in: header
/countries/{countryId}/cinemas/{theatreid}/screens:
get:
description: Returns a list of Auditoriums that is currently running in a specific city. Ordered by movie name in ascending order.
operationId: getAuditoriumsInTheatre
parameters:
- name: theatreid
in: path
- name: Accept-Language
in: header
- name: LBPATH
in: header
components:
schemas:
ProfileNotifications:
properties:
iWantEmails:
type: boolean
iWantSMS:
type: boolean
iWantPushNotifications:
type: boolean
OfferActivateRequest:
properties:
offerId:
type: int64
osType:
$ref: '#/components/schemas/OSType'
mobileId:
type: string
activationDate:
type: date
Customer:
properties:
type:
$ref: '#/components/schemas/TicketType'
count:
type: int32
Profile$ProfileStatus:
properties:
Booking:
properties:
profileId:
type: string
remoteEntityIds:
type: array
items:
string
customers:
type: array
items:
$ref: '#/components/schemas/Customer'
showId:
type: string
seatsUnnumberedCount:
type: int32
ProfileFriend:
properties:
name:
type: string
profileReferenceCode:
type: string
OfferConsumeRequest:
properties:
offerId:
type: int64
osType:
$ref: '#/components/schemas/OSType'
mobileId:
type: string
Profile:
properties:
language:
type: string
children:
type: array
items:
int32
city:
type: string
memberSince:
type: date
status:
$ref: '#/components/schemas/Profile$ProfileStatus'
firstName:
type: string
lastName:
type: string
phonenumber:
type: string
socialSecurityNumber:
type: string
acceptedTermsAndConditionsOn:
type: date
acceptedGeneralDataProtectionRegulationOn:
type: date
profileId:
type: string
currentLevelId:
type: string
aztecCode:
type: string
allowSfBioToSendNewsletters:
type: boolean
favoriteMovies:
type: array
items:
string
spendingPointsWillExpire:
type: array
items:
$ref: '#/components/schemas/SpendingPoint'
friends:
type: array
items:
$ref: '#/components/schemas/ProfileFriend'
userEmail:
type: string
providerId:
type: int32
providerToken:
type: string
memberNumber:
type: string
userHasVerifiedThisAccount:
type: boolean
loyaltyLevelId:
type: string
loyaltyLevelName:
type: string
loyaltyLevelSince:
type: date
loyaltyLevelExpiration:
type: date
loyaltyPointsAvailableForSpending:
type: int32
loyaltyMoviesLeftToTheNextLevel:
type: int32
loyaltyPointsLeftToTheNextLevel:
type: int32
loyaltyPointsLevelToGetGoldMember:
type: int32
loyaltyMovieLevelToGetGoldMember:
type: int32
loyaltySpendingPointsExpireDate:
type: date
loyaltySpendingPointsExpireAmount:
type: int32
oldClubCardNumber:
type: string
loyaltyEndDate:
type: date
CardType$Type:
properties:
purchaseCard:
type: boolean
Card:
properties:
type:
$ref: '#/components/schemas/CardType$Type'
number:
type: string
requestedAmount:
type: int32
deductedAmount:
type: int32
isUsed:
type: boolean
balance:
type: int32
errorCode:
type: int32
LockSeats:
properties:
seatKeys:
type: array
items:
$ref: '#/components/schemas/SeatKey'
auditoriumSys99Code:
type: string
dateTime:
type: int64
SeatKey:
properties:
seatRow:
type: int32
seatSection:
type: string
seatId:
type: int32
ShowKey:
properties:
Payment:
properties:
email:
type: string
profileId:
type: string
serialVersionUID:
type: int64
ticketTypes:
type: array
items:
$ref: '#/components/schemas/TicketType'
easyPayment:
$ref: '#/components/schemas/EasyPayment'
reservationPayment:
type: boolean
reservationNumber:
type: string
cards:
type: array
items:
$ref: '#/components/schemas/Card'
showKey:
$ref: '#/components/schemas/ShowKey'
bookingId:
type: int32
redirectUrl:
type: string
transactionId:
type: string
customers:
type: array
items:
$ref: '#/components/schemas/Customer'
goggleCount:
type: int32
paymentResponseCode:
type: string
Reservation:
properties:
email:
type: string
profileId:
type: string
cards:
type: array
items:
$ref: '#/components/schemas/Card'
bookingId:
type: int32
customers:
type: array
items:
$ref: '#/components/schemas/Customer'
msisdn:
type: string
showId:
type: string
goggleCount:
type: int32
totalFee:
type: int32
adultTicketCount:
type: int32
childTicketCount:
type: int32
pensionerTicketCount:
type: int32
plusAndVipTicketCount:
type: int32
totalPlusAndVipTicketCost:
type: int32
SpendingPoint:
properties:
expireDate:
type: date
amount:
type: int32
ProfileMovies:
properties:
movies:
type: array
items:
string
OSType:
properties:
ProfileCinemas:
properties:
cinemas:
type: array
items:
string
LockSeatsUnnumbered:
properties:
auditoriumSys99Code:
type: string
dateTime:
type: int64
nrOfSeats:
type: int32
TicketType:
properties:
EasyPayment:
properties:
panHash:
type: string
truncPan:
type: string
userAccept:
type: boolean
Problem Description:
I’m using http://editor.swagger.io to design an API and I get an error which I don’t know how to address:
Schema error at paths['/employees/{employeeId}/roles'].get.parameters[0]
should NOT have additional properties
additionalProperty: type, format, name, in, description
Jump to line 24
I have other endpoints defined in a similar way, and don’t get this error. I wondered if I had some issue with indentation or unclosed quotes, but that doesn’t seem to be the case. Google also did not seem to provide any useful results.
swagger: "2.0"
info:
description: Initial draft of the API specification
version: '1.0'
title: App 4.0 API
host: api.com
basePath: /v1
tags:
- name: employees
description: Employee management
schemes:
- https
paths:
/employees/{employeeId}/roles:
get:
tags:
- employees
summary: "Get a specific employee's roles"
description: ''
operationId: findEmployeeRoles
produces:
- application/json
parameters:
- name: employeeId <====== Line 24
in: path
description: Id of employee whose roles we are fetching
type: integer
format: int64
responses:
'200':
description: successful operation
schema:
type: array
items:
$ref: '#/definitions/Role'
'403':
description: No permission to see employee roles
'404':
description: EmployeeId not found
Any Hints?
Solution – 1
The error message is misleading. The actual error is that your path parameter is missing required: true
. Path parameters are always required, so remember to add required: true
to them.
Solution – 2
The syntax requires might require two parameters, as mentioned by Helen required: true
is need so is type:DataType
. The error is misleading.
Solution – 3
Had the same problem. I accidentally mixed up the syntax from Swagger 2.0
with Openapi 3.0.x
. In Openapi 3.0.x
, definitions are redefined as components. In the online editor you can click on the button Edit > Convert to OpenAPI 3 to use Openapi 3.0.x
.
Read more about components here.
Remark:
OAS 3 is the latest version of the
OpenAPI Specification.
Solution – 4
In my case I was missing parameter definition in api definition
- name: parameterName
in: query
description: parameter's description here.
required: false
schema:
type: string
Solution – 5
For me the cause of the error was a missing a leading slash in the path (internal/resource
instead of /internal/resource
).
And yes the error message is extremely unhelpful.
Solution – 6
In my case it had the wrong indentation for the example. It was:
content:
application/json:
schema:
$ref: '#/components/schemas/someresponse'
examples:
example1:
value:
param1: "some string"
param2: "123"
Rather than:
content:
application/json:
schema:
$ref: '#/components/schemas/someresponse'
examples:
example1:
value:
param1: "some string"
param2: "123"
But the VScode open api preview with swaggerUI didn’t show any errors and everything looked valid.
I am trying to create swagger json and trying to check it’s validity in
http://editor.swagger.io
Upon validating the json, the above mentioned editor gives the following error:
Schema error should NOT have additional properties
additionalProperty: components
Jump to line 0
If for some reason I can’t define an element named components at root level where i am going to have some sort of json schema, what is the right way to do a $ref on the schema for requestBody for an API operation as I intend to do as seen in my example below. Also, do you see anything wrong with my swagger json ?
My swagger json for swagger2.0 look like this.
{
"swagger": "2.0",
"info": {
"version": "1.0",
"title": "My swagger API",
"contact": {
"name": "myName",
"email": "[email protected]"
}
},
"host": "localhost:1234",
"basePath": "/",
"tags": [{
"name": "someTagName",
"description": "this is a try"
}],
"components":{"schemas": {"myEndPoint": ""}},
"paths": {
"/myEndPoint": {
"post": {
"tags": ["some-tag"],
"summary": "myEndPoint endpoint will give you something",
"description": "some description will go here",
"operationId": "getMyEndPoint",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [{
"in": "body",
"name": "somePayload",
"description": "somePayload is what this is",
"required": true,
"schema": {
"$ref": "#components/schemas/myEndPoint"
}
},
{
"in": "header",
"name": "Authorization",
"description": "auth token goes here",
"required": true,
"type": "string"
}],
"responses": {
"200": {
"description": "Success",
"schema": {
"type": "string"
}
},
"400": {
"description": "Bad Request"
}
}
}
}
}
}