zalando / innkeeper

Simple route management API for Skipper
Other
166 stars 21 forks source link

Swagger.yaml is invalid #204

Closed Unisay closed 7 years ago

Unisay commented 7 years ago
ylazaryev@ylazaryev ~/p/innkeeper (master)> swagger validate swagger.yaml 
{ [YAMLException: incomplete explicit mapping pair; a key node is missed at line 178, column 53:
     ... n: The subresources to embed. Eg: path, hosts
                                         ^]
  name: 'YAMLException',
  reason: 'incomplete explicit mapping pair; a key node is missed',
  mark: 
   Mark {
     name: null,
     buffer: 'swagger: \'2.0\'\ninfo:\n  title: Innkeeper (Route Manager)\n  description: |\n    API for manipulating Fashion Store routes. It allows all teams to access\n    and define non-wildcard paths to all relevant users in employee realm as\n    well as, some service realm clients (e.g. CMS). Creation of wildcard routes\n    is reserved for maintainers of this API as it requires special care.\n  version: 3.0.0\nhost: innkeeper.host.eu\nschemes:\n  - https\nbasePath: /\nconsumes:\n  - application/json\nproduces:\n  - application/json\nsecurityDefinitions:\n  company:\n    type: oauth2\n    authorizationUrl: \'https://auth.provider.com/z/XUI/#login/\'\n    flow: implicit\n    scopes:\n      routes.read: |\n        Reading (listing) all the routes\n      routes.write: |\n        All operations on routes with strict path matching.\n      routes.admin: |\n        All operations on all routes, including ones with regex path matching.\npaths:\n  \'/hosts\':\n    get:\n      security:\n        - company:\n          - routes.read\n      summary: Returns the list of available hosts.\n      responses:\n        \'200\':\n          description: An array of available hosts.\n          schema:\n            type: array\n            items:\n              $ref: \'#/definitions/Host\'\n        default:\n          description: A processing or an unexpected error.\n          schema:\n            $ref: \'#/definitions/Error\'\n  \'/paths\':\n    post:\n      security:\n        - company:\n          - routes.write\n      summary: Creates a new path resource that belongs to the team of the creator.\n      parameters:\n        - name: path\n          in: body\n          description: Path to create.\n          required: true\n          schema:\n            $ref: \'#/definitions/PathIn\'\n      responses:\n        \'201\':\n          description: The path is created.\n          schema:\n            $ref: \'#/definitions/PathOut\'\n        default:\n          description: A processing or an unexpected error.\n          schema:\n            $ref: \'#/definitions/Error\'\n    get:\n      security:\n        - company:\n          - routes.read\n      summary: A list of available paths.\n      parameters:\n        - name: team\n          in: query\n          type: string\n          required: false\n        - name: uri\n          in: query\n          type: string\n          required: false\n      responses:\n        \'200\':\n          description: Array of paths.\n          schema:\n            type: array\n            items:\n              $ref: \'#/definitions/PathOut\'\n        default:\n          description: A processing or an unexpected error.\n          schema:\n            $ref: \'#/definitions/Error\'\n  \'/paths/{id}\':\n    get:\n      security:\n        - company:\n          - routes.read\n      summary: Information about a single path.\n      parameters:\n        - name: id\n          in: path\n          type: string\n          required: true\n      responses:\n        \'200\':\n          description: A path with a given `id`.\n          schema:\n            $ref: \'#/definitions/PathOut\'\n        \'404\':\n          description: Happens when path does not exist.\n          schema:\n            $ref: \'#/definitions/Error\'\n        default:\n          description: A processing or an unexpected error.\n          schema:\n            $ref: \'#/definitions/Error\'\n    patch:\n      security:\n        - company:\n          - routes.write\n      summary: Partially update a path.\n      parameters:\n        - name: id\n          in: path\n          type: string\n          required: true\n        - name: pathPatch\n          in: body\n          description: Path values to update.\n          required: true\n          schema:\n            $ref: \'#/definitions/PathPatch\'\n      responses:\n        \'200\':\n          description: The updated path.\n          schema:\n            $ref: \'#/definitions/PathOut\'\n        \'404\':\n          description: Happens when path does not exist.\n          schema:\n            $ref: \'#/definitions/Error\'\n        default:\n          description: A processing or an unexpected error.\n          schema:\n            $ref: \'#/definitions/Error\'\n  \'/routes\':\n    get:\n      security:\n        - company:\n          - routes.read\n      summary: Returns the list of all the routes.\n      parameters:\n        - name: name\n          in: query\n          description: The name of the route to filter for\n          required: false\n          type: string\n        - name: owned_by_team\n          in: query\n          description: The team name to filter for\n          required: false\n          type: string\n        - name: uri\n          in: query\n          description: The path uri to filter for\n          required: false\n          type: string\n        - name: path_id\n          in: query\n          description: The path id to filter for\n          required: false\n          type: integer\n          format: int64\n        - name: embed\n          in: query\n          description: The subresources to embed. Eg: path, hosts\n          required: false\n          type: string\n      responses:\n        \'200\':\n          description: An array of routes\n          schema:\n            type: array\n            items:\n              $ref: \'#/definitions/RouteOut\'\n        default:\n          description: A processing or an unexpected error.\n          schema:\n            $ref: \'#/definitions/Error\'\n    post:\n      security:\n        - company:\n          - routes.write\n      summary: Creating a route with specified name.\n      parameters:\n        - name: route\n          in: body\n          description: Route to add.\n          required: true\n          schema:\n            $ref: \'#/definitions/RouteIn\'\n      responses:\n        \'201\':\n          description: The route is created.\n          schema:\n            $ref: \'#/definitions/RouteOut\'\n        \'403\':\n          description: |\n            Usually happens in a case of insufficient permissions.\n          schema:\n            $ref: \'#/definitions/Error\'\n        default:\n          description: A processing or an unexpected error.\n          schema:\n            $ref: \'#/definitions/Error\'          \n  \'/current-routes\':\n    get:\n      security:\n        - company:\n          - routes.read\n      summary: Returns the list of all the active routes.\n      responses:\n        \'200\':\n          description: An array of routes\n          schema:\n            type: array\n            items:\n              $ref: \'#/definitions/RouteOut\'\n        default:\n          description: A processing or an unexpected error.\n          schema:\n            $ref: \'#/definitions/Error\'\n  \'/routes/{id}\':\n    get:\n      security:\n        - company:\n          - routes.read\n      summary: Information about a single route.\n      parameters:\n        - name: id\n          in: path\n          type: string\n          required: true\n        - name: embed\n          in: query\n          description: The subresources to embed. Eg: path, hosts\n          required: false\n          type: string\n      responses:\n        \'200\':\n          description: A route with a given `id`.\n          schema:\n            $ref: \'#/definitions/RouteOut\'\n        \'404\':\n          description: Happens when trying to access a non-existent Route.\n          schema:\n            $ref: \'#/definitions/Error\'\n        default:\n          description: A processing or an unexpected error.\n          schema:\n            $ref: \'#/definitions/Error\'\n    patch:\n      security:\n        - company:\n          - routes.write\n      summary: Partially update a route.\n      parameters:\n        - name: id\n          in: path\n          type: string\n          required: true\n        - name: routePatch\n          in: body\n          description: Route values to update.\n          required: true\n          schema:\n            $ref: \'#/definitions/RoutePatch\'\n      responses:\n        \'200\':\n          description: The updated route.\n          schema:\n            $ref: \'#/definitions/RouteOut\'\n        \'403\':\n          description: |\n            Usually happens in a case of insufficient permissions.\n          schema:\n            $ref: \'#/definitions/Error\'\n        default:\n          description: A processing or an unexpected error.\n          schema:\n            $ref: \'#/definitions/Error\'\n    delete:\n      security:\n        - company:\n          - routes.write\n      summary: Deletes a route\n      parameters:\n        - name: id\n          in: path\n          type: string\n          required: true\n      description: |\n        Deleting a route is only allowed for a client that originally defined\n        this route or with admin credentials.\n      responses:\n        \'200\':\n          description: Information about a deleted route\n          schema:\n            $ref: \'#/definitions/RouteOut\'\n        \'403\':\n          description: |\n            Usually happens in a case of insufficient permissions.\n          schema:\n            $ref: \'#/definitions/Error\'\n        \'404\':\n          description: Happens when trying to delete a non-existent Route.\n          schema:\n            $ref: \'#/definitions/Error\'\n        default:\n          description: A processing or an unexpected error.\n          schema:\n            $ref: \'#/definitions/Error\'\n  \'/updated-routes/{id}\':\n    get:\n      security:\n        - company:\n          - routes.read\n      parameters:\n        - name: id\n          in: path\n          type: string\n          required: true\n          format: ISO-8601\n      summary: Returns a list of updated routes.\n      responses:\n        \'200\':\n          description: An array of route updates\n          schema:\n            type: array\n            items:\n              $ref: \'#/definitions/RouteChange\'\n        default:\n          description: A processing or an unexpected error.\n          schema:\n            $ref: \'#/definitions/Error\'\ndefinitions:\n  RouteIn:\n    required:\n      - name\n      - uses_common_filters\n      - predicates\n      - filters\n      - endpoint\n      - path_id\n    properties:\n      name:\n        type: string\n        pattern: /[A-Z][A-Z0-9_]*\n        description: The name of the route in the ROUTE_NAME format\n      uses_common_filters:\n        type: boolean\n        description: Specifies if the route uses the configured common filters\n      description:\n        type: string\n        description: Human readable description for the route\n      activate_at:\n        type: string\n        description: The ISO-8601 date time when the route will be activated\n      predicates:\n        type: array\n        $ref: \'#/definitions/Predicate\'\n        description: |\n          Definition of predicates to be applied\n      filters:\n        type: array\n        $ref: \'#/definitions/Filter\'\n        description: |\n          Definition of filters to be applied. fashionStore() filter is a mandatory filter and\n          must always present\n      endpoint:\n        type: string\n        description: |\n          A valid http(s) endpoint that the request should be routed to\n      path_id:\n        type: integer\n        format: int64\n      host_ids:\n        type: array\n        items:\n          type: integer\n          format: int64\n        description: |\n          Ids of the hosts to which route has to be applied. This list must be \n          a sublist of the host ids for the path.\n  RoutePatch:\n    properties:\n      uses_common_filters:\n        type: boolean\n        description: Specifies if the route uses the configured common filters\n      description:\n        type: string\n        description: Human readable description for the route\n      predicates:\n        type: array\n        $ref: \'#/definitions/Predicate\'\n        description: |\n          Definition of predicates to be applied\n      filters:\n        type: array\n        $ref: \'#/definitions/Filter\'\n        description: |\n          Definition of filters to be applied.\n      endpoint:\n        type: string\n        description: |\n          A valid http(s) endpoint that the request should be routed to\n      host_ids:\n        type: array\n        items:\n          type: integer\n          format: int64\n        description: |\n          Ids of the hosts to which route has to be applied. This list must be\n          a sublist of the host ids for the path.\n  RouteOut:\n    required:\n      - id\n      - path_id\n      - name\n      - uses_common_filters\n      - predicates\n      - filters\n      - endpoint\n      - created_at\n      - activate_at\n      - owned_by_team\n      - created_by\n    properties:\n      id:\n        type: integer\n        format: int64\n      path_id:\n        type: integer\n        format: int64\n      name:\n        type: string\n        pattern: \\[a-zA-Z][a-zA-Z0-9_]*\n        description: The name of the route in the ROUTE_NAME format\n      uses_common_filters:\n        type: boolean\n        description: Specifies if the route uses the configured common filters\n      description:\n        type: string\n        description: Human readable description for the route\n      created_at:\n        type: string\n        description: The ISO-8601 date time when the route has been created\n      activate_at:\n        type: string\n        description: The ISO-8601 date time when the route will be activated\n      owned_by_team:\n        type: string\n      created_by:\n        type: string\n      predicates:\n        type: array\n        $ref: \'#/definitions/Predicate\'\n        description: |\n          Definition of predicates to be applied\n      filters:\n        type: array\n        $ref: \'#/definitions/Filter\'\n        description: |\n          Definition of filters to be applied.\n      endpoint:\n        type: string\n        description: |\n          A valid http(s) endpoint that the request should be routed to\n      host_ids:\n        type: array\n        items:\n          type: integer\n          format: int64\n        description: |\n          Ids of the hosts to which route has to be applied. This list is a sublist\n          of the host ids for the path.\n  RouteChange:\n    required:\n      - type\n      - timestamp\n      - name\n      - eskip\n    properties:\n      type:\n        type: string\n        description: the type of the RouteChange (create update or delete)\n      timestamp:\n        type: string\n        description: The ISO-8601 date time when the route will be activated\n      name:\n        type: string\n        description: Route name\n      eskip:\n        type: string\n        description: The Route in eskip format\n  Predicate:\n    required:\n      - name\n      - args\n    properties:\n      name:\n        type: string\n        description: |\n          The name of the predicate, as it is definined in Skipper\n      args:\n        description: The arguments for the predicate, can be string or float64\n        type: array\n        items:\n          type: string\n  Filter:\n    required:\n      - name\n      - args\n    properties:\n      name:\n        type: string\n        description: |\n          The name of the filter, as it is definined in Skipper\n      args:\n        description: The arguments for the filter, can be string or float64\n        type: array\n        items:\n          type: string\n  Host:\n    required:\n      - id\n      - name\n    properties:\n      id:\n        type: string\n        format: int32\n      name:\n        type: string\n    example: |\n      {\n        "id": "1",\n        "name": "zalando.de"\n      }\n  PathIn:\n    required:\n      - uri\n      - host_ids\n    properties:\n      uri:\n        type: string\n        description: empty uri are not allowed\n        pattern: .+\n      host_ids:\n        type: array\n        items:\n          type: string\n    example: |\n      {\n        "uri": "/cart",\n        "host_ids": ["1", "2"]\n      }\n  PathOut:\n    required:\n      - id\n      - owned_by_team\n      - created_by\n      - uri\n      - host_ids\n      - created_at\n    properties:\n      id:\n        type: string\n      owned_by_team:\n        type: string\n      created_by:\n        type: string\n      uri:\n        type: string\n      host_ids:\n        type: array\n        items:\n          type: string\n      created_at:\n        type: string\n        format: date-time\n    example: |\n      {\n        "id": "1",\n        "owned_by_team": "coast",\n        "created_by": "user",\n        "uri": "/cart",\n        "host_ids": ["1", "2"],\n        "created_at": "1985-04-12T23:20:50.52Z"\n      }\n  PathPatch:\n    properties:\n      owned_by_team:\n        type: string\n      host_ids:\n        type: array\n        items:\n          type: string\n    example: |\n      {\n        "owned_by_team": "coast",\n        "host_ids": ["1", "2"]\n      }\n  Error:\n    required:\n      - type\n      - status\n      - title\n    properties:\n      type:\n        type: string\n      status:\n        type: integer\n        format: int32\n      title:\n        type: string\n        description: Short description of an error\n      detail:\n        type: string\n        description: Detailed description of an error\n\u0000',
     position: 4882,
     line: 177,
     column: 52 },
  message: 'incomplete explicit mapping pair; a key node is missed at line 178, column 53:\n     ... n: The subresources to embed. Eg: path, hosts\n                                         ^' }⏎                                
Unisay commented 7 years ago

JFYI:

ylazaryev@ylazaryev ~/p/innkeeper (master)> swagger validate swagger.yaml 

Project Errors
--------------
#/definitions/RouteIn/properties/predicates: Missing required property: items
#/definitions/RouteIn/properties/filters: Missing required property: items
#/definitions/RoutePatch/properties/predicates: Missing required property: items
#/definitions/RoutePatch/properties/filters: Missing required property: items
#/definitions/RouteOut/properties/predicates: Missing required property: items
#/definitions/RouteOut/properties/filters: Missing required property: items

Project Warnings
----------------
#/securityDefinitions/company/scopes/routes.admin: Security definition scope is defined but is not used: #/securityDefinitions/company/scopes/routes.admin
Results: 6 errors, 1 warnings
NorthFury commented 7 years ago

The remaining errors have been fixed.