Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG][AVRO] String of type byte is not well converted to Avro Bytes format #20567

Open
5 of 6 tasks
npfp opened this issue Jan 31, 2025 · 0 comments
Open
5 of 6 tasks

Comments

@npfp
Copy link

npfp commented Jan 31, 2025

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

When trying to generate an Avro schema from an open api spec that contains a type string with format byte, the corresponding generated type is "mode.Bytes" instead of "bytes".

    {
      "name": "certi",
      "type": ["null", "model.Bytes"],
      "doc": "Base64 encoded certificate",
      "default": null
    }

instead of

    {
      "name": "certi",
      "type": ["null", "bytes"],
      "doc": "Base64 encoded certificate",
      "default": null
    }
openapi-generator version

openapi-generator-cli 7.10.0
commit : 12dfe8f

OpenAPI declaration file content or url
openapi: 3.0.1
info:
  title: Sample API
  description: Optional multiline or single-line description in [CommonMark](http://commonmark.org/help/) or HTML.
  version: 0.1.9

servers:
  - url: http://api.example.com/v1
    description: Optional server description, e.g. Main (production) server
  - url: http://staging-api.example.com
    description: Optional server description, e.g. Internal staging server for testing

paths:
  /users:
    get:
      summary: Returns a list of users.
      description: Optional extended description in CommonMark or HTML.
      responses:
        "200": # status code
          description: A JSON array of user names
          content:
            application/json:
              schema:
                type: array
                items:
                  type: string
components:
  schemas:
    Alert:
      type: object
      properties:
        certi:
          description: Base64 encoded certificate
          type: string
          format: byte
Steps to reproduce
openapi-generator-cli generate -g avro-schema -i resources/test/openapi-spec.yaml -o test
Related issues/PRs
Suggest a fix

I'd be happy to try to fix it, but I'm fairly new to mustach template within openapi generator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant