Skip to content

[Ada] wrong order for data structures in *-model.ads files #7485

@michelealbano

Description

@michelealbano
Description

Wrong order with the models in the *-model.ads files. The compilation ends with a:

arrowhead-orchestrator-models.ads:19:56: "StringsMap_Type" not declared in "Models"

An inspection of the ads file confirm the problem.

Swagger-codegen version

Current version on github (January 24th, 2018) with the patch to issues #7457 and #7462.

Swagger declaration file content or url
swagger: '2.0'
host: 127.0.0.1:8442
basePath: "/orchestrator"
schemes:
  - http
consumes:
  - application/json
produces:
  - application/json


paths: 
  /orchestration:
    post:
      description: Query an orchestrated service instance
      operationId: orchStore
      parameters:
        - name: serviceRequestForm
          in: body
          description: Requests an orchestrated service instance
          required: true
          schema:
            type: object
            required:
              - requesterSystem
              - requestedService
              - requestedQoS
            properties:
              requestedService:
                $ref: '#/definitions/arrowheadService'
      responses:
        200:
          description: Response to a service orchestration request
        default:
          description: Unexpected error



definitions: 
  arrowheadSystem:
    type: object
    required:
      - "systemName"
    properties:
      systemName:
        type: string
  arrowheadService:
    type: object
    required:
      - serviceGroup
      - serviceMetadata
    properties:
      serviceGroup:
        type: string
      serviceMetadata:
        $ref: '#/definitions/stringsMap'
  stringsMap:
    type: "object"
    properties:
      entry:
        type: string

Command line used for generation

java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate -i ../../openapiAHorchBadOrder.yml -l ada -o ../../ada-ahBadOrder/ --api-package Arrowhead.Orchestrator --model-package Arrowhead.Orchestrator

Steps to reproduce

Compile the *-models.ads / *-models.adb. The result is a:

arrowhead-orchestrator-models.ads:19:56: "StringsMap_Type" not declared in "Models"

Related issues/PRs

This issue is a follow-up of issues #7457 and #7462.

Suggest a fix/enhancement

Rework the sort method in postProcessModels method in file swagger-codegen\modules\swagger-codegen\src\main\java\io\swagger\codegen\languages\AbstractAdaCodegen.java

I am providing a potential fix in one hour, for you to consider it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions