Please help translate Swagger 2.0 simple example to OAS3

29 views
Skip to first unread message

Daniel Belcher

unread,
Feb 12, 2018, 11:46:10 AM2/12/18
to Swagger
Hi All-

I managed to get a simple POST API with swagger 2.0 before realizing I should probably start learning and experimenting with OAS3 instead.  Here is the working swagger 2.0 simple test that works great:

swagger: "2.0"
# ...
paths
:
 
/Rhino/Geometry/Point3d/New:
    post
:
      tags
:
     
- "all"
      summary
: "Create new Point3d"
      operationId
: "Point3dNew"
      consumes
:
     
- "application/json"
      produces
:
     
- "application/json"
      parameters
:
     
- in: "body"
        name
: "body"
        required
: true
        schema
:
          type
: "array"
          items
:
            type
: "number"
      responses
:
       
200:
          description
: "OK"
       
400:
          description
: "Invalid input"

I can POST the following:

[
 
1,2,3
]

and it returns the following Response body:

{"X":1.0,"Y":2.0,"Z":3.0}

...which is great, so far so good.  

However, I'm having trouble figuring out how to translate this to OAS3.  I'm afraid the petstore sample is a little too complex for this rather dumb API (and rather dumb developer).

Any help would be appreciated,
-Dan

Ron Ratovsky

unread,
Feb 12, 2018, 4:43:55 PM2/12/18
to swagger-sw...@googlegroups.com

You can use a converter tool such as oai.swagger.io/api/convert?url=<...>.

--
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.

Daniel Belcher

unread,
Feb 12, 2018, 5:07:17 PM2/12/18
to Swagger
Ah, interesting.  Well, that would come in useful, but I'm just learning swagger and I don't yet have a spec published, so I can't really use that converter.

To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.
For more options, visit
https://groups.google.com/d/optout.

Ron Ratovsky

unread,
Feb 12, 2018, 5:38:25 PM2/12/18
to swagger-sw...@googlegroups.com

You can create a gist at gist.github.com, and feed the converter the link to the raw instance of the gist.

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.

--

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.

Daniel Belcher

unread,
Feb 12, 2018, 5:51:45 PM2/12/18
to Swagger
Thanks Ron!  That worked and was quite helpful.

To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.
For more options, visit
https://groups.google.com/d/optout.

--
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-swaggersocket+unsub...@googlegroups.com.
For more options, visit
https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages