Swagger editor not displaying Composed Model Names Correctly

59 views
Skip to first unread message

Ben Sullivan

unread,
Apr 20, 2017, 5:19:06 AM4/20/17
to Swagger
Hi everyone

I have the following swagger spec:

swagger: '2.0'
info
:
  title
: 'Adviser Service'
  version
: '1.0.0'
paths
:
 
/api/v1/advisers:
    post
:
      description
: Create an `Adviser`
      consumes
:
       
- application/vnd.api+json
      produces
:
       
- application/vnd.api+json
      parameters
:
       
- name: adviser
         
in: body
          required
: true
          schema
:
            $ref
: '#/definitions/CreateAdviser'
      responses
:
       
201:
          description
: Created
          schema
:
            $ref
: '#/definitions/Adviser'
definitions
:
 
CreateAdviser:
    properties
:
      data
:
        $ref
: '#/definitions/CreateAdviserResource'
 
CreateAdviserResource:
    allOf
:
   
- $ref: "#/definitions/AdviserResourceIdentifier"
   
- type: object
      properties
:
        attributes
:
          $ref
: '#/definitions/CreateAdviserResourceAttributes'
 
AdviserResourceIdentifier:
    required
:
     
- id
     
- type
    properties
:
      id
:
        type
: string
      type
:
        type
: string
       
enum:
         
- advisers
 
CreateAdviserResourceAttributes:
    properties
:
      name
:
        type
: string
      description
:
        type
: string
      data
:
        type
: string
 
AdviserResourceAttributes:
    properties
:
      name
:
        type
: string
      description
:
        type
: string
 
Adviser:
    properties
:
      data
:
        allOf
:
       
- $ref: '#/definitions/AdviserResourceIdentifier'
       
- type: object
          properties
:
            attributes
:
              $ref
: '#/definitions/AdviserResourceAttributes'

When I view this in editor.swagger.io, the CreateAdviserResource model name is not displayed in the Models section and instead AdviserResourceIdentifier is displayed as the model name alongside the AdviserResourceIdentifier model I am expecting.  The definition of the CreateAdviserResource model looks right, it's just it's name is incorrect (and duplicated).  All the other models look ok.

I'm not sure what I'm doing wrong.  Any hints would be much appreciated!

Many thanks

Ben

Ron Ratovsky

unread,
Apr 20, 2017, 6:11:19 AM4/20/17
to swagger-sw...@googlegroups.com

Hi Ben,

 

It looks like a bug.

Can you file a ticket on the issue please? If so, do it on swagger-ui as the issue is with the rendering and not the editor itself.

 

Thanks,

Ron

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

Reply all
Reply to author
Forward
0 new messages