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
  • #3189
Closed
Open
Issue created Jun 20, 2019 by Administrator@rootContributor

[BUG][RUST-SERVER] binary strings should not be base64 encoded

Created by: lelongg

The rust-server code generator handles binary and byte string format the same way. Both are base64 encoded automatically while binary strings should not perform this transformation as stated in OAS3.2.

Description

The formats defined by the OAS are:

type format Comments
string byte base64 encoded characters
string binary any sequence of octets
openapi-generator version

Tested with docker image openapitools/openapi-generator-cli with version 4.0.1-SNAPSHOT.

OpenAPI declaration file content or url
responses:
    "200":
      description: "OK"
      content:
        image/png:
          schema:
            type: string
            format: binary
Command line used for generation
docker run --rm -u $(id -u ${USER}):$(id -g ${USER}) -v ${PWD}:/local -w /local openapitools/openapi-generator-cli generate \
    --enable-post-process-file \
    --generate-alias-as-model \
    -i /local/openapi/openapi.yaml \
    -g rust-server \
    -o /local/packages/rust-server \
    -DpackageName=server
Related issues/PRs

Issue #538 (closed) mentions binary and byte string but doesn't mention how they should be handled differently.

Suggest a fix

Vec<u8> should be used for binary string instead of swagger::ByteArray.

Assignee
Assign to
Time tracking