When defining an API schema that uses root as it’s path, the collection generated causes collection schema validation error.
Schema:
openapi: "3.0.1"
info:
title: "Shippers"
version: "1.0.0"
servers:
- url: "{baseUrl}"
paths:
/:
post:
summary: Create Shipper
description: Create a Shipper user.
operationId: createShipper
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/CreateShipperRequest"
example:
email: "{{USER_NAME}}"
password: "{{PASSWORD}}"
responses:
200:
description: "200 OK"
content:
application/json:
schema:
$ref: "#/components/schemas/ShipperAndCompanyResponse"
example:
status: 200
code: 2001
message: "The shipper was created."
data:
shipper:
email: "[email protected]"
400:
description: "400 Bad Request - Shipper already exists"
content:
application/json:
schema:
$ref: "#/components/schemas/Response"
example:
status: 400
code: 4002
message: "Shipper already exists."
components:
schemas:
CreateShipperRequest:
title: "Create Shipper Request Schema"
required:
- "email"
- "password"
type: "object"
properties:
email:
type: string
password:
type: string
Response:
title: "Response Schema"
required:
- "status"
- "code"
- "message"
type: "object"
properties:
status:
type: integer
code:
type: integer
message:
type: string
ShipperAndCompanyResponse:
title: "Shipper and Company Response Schema"
allOf:
- $ref: '#/components/schemas/Response'
- type: object
required:
- "data"
properties:
data:
required:
- "shipper"
- "company"
type: object
properties:
shipper:
required:
- "email"
type: object
properties:
email:
type: string
securitySchemes:
authorizer:
type: "apiKey"
name: "Authorization"
in: "header"
x-amazon-apigateway-authtype: "custom"
Postman API Schema Editor found no validation errors.
Validate collection against schema:
Postman Validation Errors when validating collection against schema:
When I accept the changes to add a new request and delete the generated request, the same validation errors are shown after re-validation.
If anyone has knows any reason why this is happening, that would be helpful. I have only encountered this when defining a root path ‘/’.