Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #8380
Closed
Open
Issue created Jan 08, 2021 by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items

[BUG][Rust Client] Duplicated crate::models in Params struct

Created by: alesharik

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

Generated rust client has duplicated crate::models string in enum field types. But rust doesn't like it and fails with 'crate' in paths can only be used in start position in compilation phase. Also tested with a as query parameter, same results

openapi-generator version

5.0.0 5.0.1-SNAPSHOT 6.0.0-SNAPSHOT

OpenAPI declaration file content or url
---
openapi: 3.0.1
info:
  title: v3
  version: 3.0.0
servers:
  - url: https://example.com
paths:
  /v3/{a}:
    get:
      parameters:
        - name: a
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/ReleaseType'
      responses:
        "200":
          description: search results matching criteria
components:
  schemas:
    ReleaseType:
      default: ga
      enum:
        - ga
        - ea
      type: string
Generation Details

Generator: rust Config:

{
  "library": "reqwest",
  "packageName": "api",
  "packageVersion": "1.0.0",
  "supportAsync": "true",
  "useSingleRequestParameter": "true"
}
Expected output (src/apis/default_api.rs)
/// struct for passing parameters to the method `v3_a_get`
#[derive(Clone, Debug)]
pub struct V3AGetParams {
    pub a: crate::models::ReleaseType
}
Actual output (src/apis/default_api.rs)
/// struct for passing parameters to the method `v3_a_get`
#[derive(Clone, Debug)]
pub struct V3AGetParams {
    pub a: crate::models::crate::models::ReleaseType
}
Assignee
Assign to
Time tracking