Skip to content

Swagger UI Does not identify definitions data type in the API documentaton window #652

@steve165

Description

@steve165

Using the swagger UI to create a swagger.yaml with a couple of complex objects. When looking at the API documentation, the type is not identified. The yaml below produced the following API documentation that did not identify the data type. It identified object in the array simply as an object and of the type referenced by the GET response schema.

Is this just an API documentation fault?

swagger: 2.0
info:
version: "0.0.1"
title: glh 'ideal' open API

during dev, should point to your local machine

host: api.glhhotels.com

basePath prefixes all resource paths

basePath: /

schemes:

tip: remove http to make production-grade

  • http
  • https

    format of bodies a client can send (Content-Type)

    consumes:
  • application/json

    format of the responses to the client (Accepts)

    produces:
  • application/json
    x-volos-resources: {}
    paths:
    /preferences/{preferenceCode}:

    binds a127 app logic to a route

    x-swagger-router-controller: preferencesController
    x-volos-authorizations: {}
    x-volos-apply: {}
    get:
    description: Returns the collection of preference codes and descriptions
    # used as the method name of the controller
    operationId: getPreferences
    parameters:
    - name: preferenceCode
    in: path
    description: An individual preference code. Add to limit the response to a single specific preference.
    required: false
    type: string
    responses:
    "200":
    description: Success
    schema:
    # a pointer to a definition
    $ref: PreferencesGetResponse
    # responses may fall through to errors
    default:
    description: Error
    schema:
    $ref: StatusResponse

definitions:

StatusResponse:
required:
- statusCode
- statusDetails
properties:
statusCode:
type: string
statusDetails:
type: string
moreInfo:
type: array
items: {"label": string, "link": string}

Preference model

PreferenceDetails:
required:
- preferenceType
- preferenceValue
properties:
preferenceTyoe:
type: string
preferenceDescription:
type: string
preferenceValue:
type: string
preferenceNotes:
type: string

PreferencesGetResponse:
required:
- status
- list
properties:
status:
type: object
$ref: StatusResponse
list:
type: array
items: {"object": "PreferenceDetails"}

2014-10-02 14 23 47

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions