swagger-api / swagger-api/swagger-codegen

Recursive model break javascript client generation

Open
#11,249 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

I have the same problem described here translating in javascript.

In the code gen deployed in swagger.editor.io and swagger hub

Swagger-codegen version

Swagger Codegen version: 2.4.21

Swagger declaration file content or url
swagger: '2.0'
info:
  description: |
    This server will expose an API to Sparqling front end to create new SPARQL queries with a combinations of point and click on the [GRAPHOLscape](https://github.com/obdasystems/grapholscape) graph. 
    Sparqling will be released as a standalone appication but also the server will embedded in [MWS](https://github.com/obdasystems/mws) and Sparqling will be integrated in [Monolith](https://www.monolith.obdasystems.com/).
  version: 1.0.0
  title: Swagger Sparqling WS
  termsOfService: http://swagger.io/terms/
  contact:
    email: info@obdasystems.com
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
# host: localhost:8080
# basePath: /sparqling
tags:
- name: OntologyGraph
  description: Depending on the selected node and the clicked node the ontology graph will change the highlightments. These results will be used essentially by GRAPHOLscape.
- name: QueryGraph
  description: Depending on the selected node and the clicked node the server will compute the query graph which will be rendered by Sparqling front end. These result will be used to render the query graph and the query head and the SPARQL code.
- name: Standalone
  description: These routes will be used only for the standalone application.
# schemes:
# - http
paths:
  /ontology/{ontologyName}/highlights:
    get:
      tags:
      - OntologyGraph
      summary: Get the IRIs of the ontology entities "related" to the clicked and selected. 
      operationId: highligths
      produces:
      - application/json
      parameters:
      - in: path
        name: ontologyName
        description: The ontology name (useful for monolith multi ontology). For standalone we should use a dummy name.
        required: true
        type: string
      - name: ontologyVersion
        in: query
        description: The IRI which describe ontology version (useful for monolith multi ontology). For standalone we should use a dummy version.
        required: true
        type: string
      - name: clickedIRI
        in: query
        description: The IRI of the entity clicked on the GRAPHOLscape ontology graph
        required: true
        type: string
      responses:
        200:
            description: successful operation
            schema:
              $ref: '#/definitions/Highlights'
        400:
          description: Invalid IRI supplied
        404:
          description: Entity not found
  /ontology/{ontologyName}/highlights/paths:
    get:
      tags:
      - OntologyGraph
      summary: Find path between selected class and clicked class. Should be based on Dijkstra algorithm for shortest paths. ISA wieght is 0 while role weight is 1.
      operationId: highligthsPaths
      produces:
      - application/json
      parameters:
      - in: path
        name: ontologyName
        description: The ontology name (useful for monolith multi ontology). For standalone we should use a dummy name.
        required: true
        type: string
      - name: ontologyVersion
        in: query
        description: The IRI which describe ontology version (useful for monolith multi ontology). For standalone we should use a dummy version.
        required: true
        type: string
      - name: lastSelectedIRI
        in: query
        description: The IRI of the entity clicked on the GRAPHOLscape ontology graph
        required: true
        type: string
      - name: clickedIRI
        in: query
        description: The IRI of the entity clicked on the GRAPHOLscape ontology graph
        required: true
        type: string
      responses:
        200:
            description: successful operation
            schema:
              $ref: '#/definitions/Paths'
        400:
          description: Invalid IRI supplied
        404:
          description: Entity not found
  /ontology/{ontologyName}/queryGraph/node:
    get:
      tags:
      - QueryGraph
      summary: Get the query graph that will be rendered by Sparqling, the query head, the sparql code.
      operationId: queryGraph
      produces:
      - application/json
      parameters:
      - in: path
        name: ontologyName
        description: The ontology name (useful for monolith multi ontology). For standalone we should use a dummy name.
        required: true
        type: string
      - name: ontologyVersion
        in: query
        description: The IRI which describe ontology version (useful for monolith multi ontology). For standalone we should use a dummy version.
        required: true
        type: string
      - name: clickedIRI
        in: query
        description: The IRI of the entity clicked on the GRAPHOLscape ontology graph
        required: true
        type: string
      - name: lastSelectedIRI
        in: query
        description: The IRI of the last selected entity. It could be selected from the ontology graph or from the query graph
        required: true
        type: string
      - name: isCyclicObjectPropertyDirect
        in: query
        description: In the case of cyclic object property specify the direction.
        type: boolean
      responses:
        200:
            description: successful operation
            schema:
              $ref: '#/definitions/QueryGraph'
        400:
          description: Invalid IRI supplied
        404:
          description: Entity not found
  /ontology/{ontologyName}/queryGraph/node/{graphNodeId}:
    delete:
      tags:
      - QueryGraph
      summary: Delete the GraphNode from the query graph (and all its children).
      operationId: deleteGraphNodeId
      produces:
      - application/json
      parameters:
      - in: body
        name: filter
        description: The filter modified
        schema:
          $ref: '#/definitions/QueryGraph'
      - in: path
        name: ontologyName
        description: The ontology name (useful for monolith multi ontology). For standalone we should use a dummy name.
        required: true
        type: string
      - in: path
        name: graphNodeId
        description: The GraphNode that should be delete
        required: true
        type: string
      - name: ontologyVersion
        in: query
        description: The IRI which describe ontology version (useful for monolith multi ontology). For standalone we should use a dummy version.
        required: true
        type: string
      responses:
        200:
            description: successful operation
            schema:
              $ref: '#/definitions/QueryGraph'
        404:
          description: GraphNode not found
  /ontology/{ontologyName}/queryGraph/head/add/{graphNodeId}:
    get:
      tags:
      - QueryGraph
      summary: Add the head term to the query graph.
      operationId: addHeadTerm
      produces:
      - application/json
      parameters:
      - in: path
        name: ontologyName
        description: The ontology name (useful for monolith multi ontology). For standalone we should use a dummy name.
        required: true
        type: string
      - name: ontologyVersion
        in: query
        description: The IRI which describe ontology version (useful for monolith multi ontology). For standalone we should use a dummy version.
        required: true
        type: string
      - in: path
        name: graphNodeId
        description: The id of the graph node that should be added to the head
        required: true
        type: string
      responses:
        200:
            description: successful operation
            schema:
              $ref: '#/definitions/QueryGraph'
        404:
          description: Graph Node not found
  /ontology/{ontologyName}/queryGraph/head/{headTerm}:
    delete:
      tags:
      - QueryGraph
      summary: Delete the head term from the query graph.
      operationId: deleteHeadTerm
      produces:
      - application/json
      parameters:
      - in: path
        name: ontologyName
        description: The ontology name (useful for monolith multi ontology). For standalone we should use a dummy name.
        required: true
        type: string
      - in: path
        name: headTerm
        description: The head term that should be delete
        required: true
        type: string
      - name: ontologyVersion
        in: query
        description: The IRI which describe ontology version (useful for monolith multi ontology). For standalone we should use a dummy version.
        required: true
        type: string
      - name: clickedIRI
        in: query
        description: The IRI of the entity clicked on the GRAPHOLscape ontology graph
        required: true
        type: string
      - name: lastSelectedIRI
        in: query
        description: The IRI of the last selected entity. It could be selected from the ontology graph or from the query graph
        required: true
        type: string
      responses:
        200:
            description: successful operation
            schema:
              $ref: '#/definitions/QueryGraph'
        404:
          description: Head term not found
  /ontology/{ontologyName}/queryGraph/filter:
    post:
      tags:
      - QueryGraph
      summary: Add filter condition to the query graph.
      operationId: addFilter
      consumes:
      - application/json
      produces:
      - application/json
      parameters:
      - in: body
        name: filter
        description: The filter to add to the query
        schema:
          $ref: '#/definitions/Filter'
      - in: path
        name: ontologyName
        description: The ontology name (useful for monolith multi ontology). For standalone we should use a dummy name.
        required: true
        type: string
      - name: ontologyVersion
        in: query
        description: The IRI which describe ontology version (useful for monolith multi ontology). For standalone we should use a dummy version.
        required: true
        type: string
      responses:
        200:
            description: successful operation
            schema:
              $ref: '#/definitions/QueryGraph'
  /ontology/{ontologyName}/queryGraph/filter/{filterIndex}:
    put:
      tags:
      - QueryGraph
      summary: Modify filter condition to the query graph.
      operationId: modifyFilter
      consumes:
      - application/json
      produces:
      - application/json
      parameters:
      - in: body
        name: filter
        description: The filter modified
        schema:
          $ref: '#/definitions/Filter'
      - in: path
        name: ontologyName
        description: The ontology name (useful for monolith multi ontology). For standalone we should use a dummy name.
        required: true
        type: string
      - in: path
        name: filterIndex
        description: The index of the filter to modify
        required: true
        type: string
      - name: ontologyVersion
        in: query
        description: The IRI which describe ontology version (useful for monolith multi ontology). For standalone we should use a dummy version.
        required: true
        type: string
      responses:
        200:
            description: successful operation
            schema:
              $ref: '#/definitions/QueryGraph'
        404:
          description: Filter not found
    delete:
      tags:
      - QueryGraph
      summary: Delete filter condition to the query graph.
      operationId: deleteFilter
      consumes:
      - application/json
      produces:
      - application/json
      parameters:
      - in: path
        name: ontologyName
        description: The ontology name (useful for monolith multi ontology). For standalone we should use a dummy name.
        required: true
        type: string
      - in: path
        name: filterIndex
        description: The index of the filter to delete
        required: true
        type: string
      - name: ontologyVersion
        in: query
        description: The IRI which describe ontology version (useful for monolith multi ontology). For standalone we should use a dummy version.
        required: true
        type: string
      responses:
        200:
            description: successful operation
            schema:
              $ref: '#/definitions/QueryGraph'
        404:
          description: Filter not found
  /ontology/{ontologyName}/queryGraph/path/{pathId}:
    get:
      tags:
      - QueryGraph
      summary: Get the query graph that will be rendered by Sparqling, the query head, the sparql code based on the chosen path.
      operationId: addPathToQueryGraph
      produces:
      - application/json
      parameters:
      - in: path
        name: ontologyName
        description: The ontology name (useful for monolith multi ontology). For standalone we should use a dummy name.
        required: true
        type: string
      - name: ontologyVersion
        in: query
        description: The IRI which describe ontology version (useful for monolith multi ontology). For standalone we should use a dummy version.
        required: true
        type: string
      - in: path
        name: pathId
        description: The path id chosen by the users from the available ones returned [here](#/OntologyGraph/highligthsPaths).
        required: true
        type: string
      responses:
        200:
            description: successful operation
            schema:
              $ref: '#/definitions/QueryGraph'
        400:
          description: Invalid IRI supplied
        404:
          description: Entity not found
  /standalone/ontology/upload:
    post:
      tags:
      - Standalone
      summary: Uploads a .graphol or .owl file. This will be used only by standalone Sparqling.
      consumes:
        - multipart/form-data
      parameters:
        - in: formData
          name: upfile
          type: file
          description: The file to upload.
      responses:
        200:
          description: successful operation
  /standalone/ontology/graphol:
    get:
      tags: 
      - Standalone
      summary: Return the graphol file as a string to be parsed by GRAPHOLscape.
      produces:
      - application/json
      responses:
        200:
          description: successful operation
          schema:
            type: string
        404:
          description: Ontology not uploaded
definitions:
  Highlights:
    type: object
    properties:
      selectedClasses:
        type: array
        items:
          type: string
      highlightedEntities:
        $ref: '#/definitions/HighlightedEntities'
  HighlightedEntities:
    type: object
    properties:
      classes:
          description: Subclasses or brother classes
          type: array
          items:
            type: string
      objectProperties:
        type: array
        items:
          $ref: '#/definitions/Branch'
      dataProperties:
        type: array
        items:
          type: string
  Branch:
    type: object
    properties:
      objectPropertyIRI:
        type: string
      cyclic:
        description: It is true when domain and range are the same class.
        type: boolean
      relatedClasses:
        type: array
        items:
          type: string
  Paths:
    type: array
    items:
      $ref: '#/definitions/Path'
  Path:
    type: object
    properties:
      id:
        type: string
      entities:
        description: Starts with lastSelectedIRI and ends with clickedIRI. In between the nodes and edges traversed in the path (ISA edge are marked as ISA)
        type: array
        items:
          type: string
  QueryGraph:
    type: object
    required:
      - head
      - graph
      - sparql
    properties: 
      head:
        type: array
        items: 
          type: string
      graph:
        $ref: '#/definitions/GraphNode'
      filters:
        type: array
        items:
          $ref: '#/definitions/Filter'
      sparql:
        type: string
  GraphNode:
    type: object
    properties:
      id:
        type: integer
      entity:
        $ref: '#/definitions/Entity'
      children:
        type: array
        items:
          $ref: '#/definitions/GraphNode'
  Entity:
    type: object
    properties:
      type:
        type: string
        enum: [class, objectProperty, dataProperty]
      iri:
        type: string
      prefixedIri:
        type: string
      labels:
        type: object
        additionalProperties:
          type: string
  Filter:
    type: object
    properties:
      expression:
        $ref: '#/definitions/BinaryExpression'
  BinaryExpression:
    type: object
    properties: 
      operator:
        type: string
      leftOperand:
        description: Could be a value or a GraphNode id
        type: string
      rightOperand:
        description: Could be a value or a GraphNode id
        type: string
  
# schemes:
#  - http
# Added by API Auto Mocking Plugin
host: virtserver.swaggerhub.com
basePath: /giacomoronconiobda/sparqling/1.0.0
schemes:
 - https
 - http
Command line used for generation

Done with swagger.editor.io

Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement

The problem is related to GraphNode resource

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing this report with the referenced issue 9800 and reproducing generation from the supplied Swagger 2.0 declaration. Inspect the JavaScript client output for the recursive model failure. Done means the declaration generates a usable JavaScript client without the recursive-model break.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.