Background
I've just started a new project and would like to use Swagger for my API
Documentation. I am currently running my project locally, hosted in IIS.
I have modified my hosts file to give the site a valid header. For this
post, let's say the header is publicapiurl.domain.com. So, I have added the
following entry to my hosts file:
127.0.0.1 publicapiurl.domain.com
Now, when I type publicapiurl.domain.com/swagger I get the swagger docs.
The initial setup seemed simple enough but I have a red 'ERROR {...}'
message at the bottom right corner of my swagger doc. The error message
reads as follows:
{"messages":["malformed or unreadable swagger supplied"],
"schemaValidationMessages":[{"level":"error","domain":"validation","keyword"
:"type","message":"instance type (string) does not match any allowed
primitive type (allowed: [\"object\"])","schema":{"loadingURI":"#","pointer"
:""},"instance":{"pointer":""}}]}
I've worked a bit with Swagger in the past so I took the provided link to
the generated swagger doc and copied the code. I pasted the code into the
swagger.io/tools editor to see what their validation process might tell me.
The code I pasted validated without any errors. Here is the code:
swagger: '2.0'
info:
version: v1
title: Generic.Public.Api
host: publicapiurl.domain.com
schemes:
- http
paths:
/api/Values:
get:
tags:
- Values
operationId: Values_Get
consumes: []
produces:
- application/json
- text/json
- application/xml
- text/xml
responses:
'200':
description: OK
schema:
type: array
items:
type: string
post:
tags:
- Values
operationId: Values_PostByvalue
consumes:
- application/json
- text/json
- application/xml
- text/xml
- application/x-www-form-urlencoded
produces: []
parameters:
- name: value
in: body
required: true
schema:
type: string
responses:
'204':
description: No Content
'/api/Values/{id}':
get:
tags:
- Values
operationId: Values_GetByid
consumes: []
produces:
- application/json
- text/json
- application/xml
- text/xml
parameters:
- name: id
in: path
required: true
type: integer
format: int32
responses:
'200':
description: OK
schema:
type: string
put:
tags:
- Values
operationId: Values_PutByidvalue
consumes:
- application/json
- text/json
- application/xml
- text/xml
- application/x-www-form-urlencoded
produces: []
parameters:
- name: id
in: path
required: true
type: integer
format: int32
- name: value
in: body
required: true
schema:
type: string
responses:
'204':
description: No Content
delete:
tags:
- Values
operationId: Values_DeleteByid
consumes: []
produces: []
parameters:
- name: id
in: path
required: true
type: integer
format: int32
responses:
'204':
description: No Content
definitions: {}
Does anyone know what the aforementioned error I am getting actually means
or how I may be able to resolve it?
My best guess is it has something to do with my modification of the hosts
file and some type of CORS issue perhaps... but I am seriously at a loss.
Any suggestions are appreciated!
--
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.