A deterministic version of a JSON schema object

498 views
Skip to first unread message

ssla...@gmail.com

unread,
Oct 9, 2015, 3:57:24 AM10/9/15
to Swagger

I am trying to use the Swagger Editor to create a custom JSON/YAML for my API. Basically I want to describe a POST request to an endpoint with Accept and Content-Type headers and POST-data in the form of JSON as in the following template {"document": "Some text paragraph", "documentType": "text/plain"}.

This is my swagger.yml file

swagger: '2.0'
info:
  title: Random title
  description: Blah blah
  version: 1.2.3
host: endpoint.com
schemes:
  - https
securityDefinitions:
  basicAuth:
    type: basic
    description: HTTP Basic Authentication.
basePath: /v1
paths:
  '/{pipelineID}':
    parameters:
      - $ref: '#/parameters/pipelineID'
    post:
      summary: Hello world
      description: World hello
      security:
        - basicAuth: []
      consumes:
        - application/json
      produces:
        - application/json
      tags:
        - TextAnnotation
      parameters:
        - name: body
          in: body
          description: JSON
          required: true
          schema:
            - $ref: "#/definitions/json"
        - name: Accept
          in: header
          required: true
        - name: Content-Type
          in: header
          required: true
      responses:
        '200':
          description: OK
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '500':
          description: Internal Server Error
parameters:
  pipelineID:
    name: pipelineID
    description: Pipeline ID
    in: path
    type: string
    required: true
definitions:
  json:
    - type: ServiceRequest
      properties:
        - "document":
          - type: string
          "documentType":
          - type: string


Swagger editor's error:

Swagger Error
A deterministic version of a JSON Schema object.
Jump to line 59

Line 59 is where the definitions start, more specifically, json

What am I doing wrong?

Tony Tam

unread,
Oct 9, 2015, 9:51:52 AM10/9/15
to swagger-sw...@googlegroups.com
The error messages can be a bit obtuse. Try changing the 'type' in your json model. It's expecting 'object' in this context. 
--
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 swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

ssla...@gmail.com

unread,
Oct 12, 2015, 4:08:21 AM10/12/15
to Swagger
Yes, i managed to figure it out. Took some time though. Thanks anyway!

sar...@phemi.com

unread,
Sep 23, 2016, 4:36:35 PM9/23/16
to Swagger
I have the same problem, what did you change?
Reply all
Reply to author
Forward
0 new messages