swagger-api / swagger-api/swagger-codegen

[Golang] Bug when using online swagger editor to generate client with google.protobuf.Value and google.protobuf.Any

Open
#11,778 0 comments 1 reaction 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

My openapi.yaml is OpenAPI3.0 version

Swagger-codegen version

online swagger editor

Swagger declaration file content or url
n:
    type: object
    properties:
        a:
            type: integer
            format: uint32
        b:
            type: integer
            format: uint32
        c:
            type: string
        d:
            type: array
            items:
                $ref: '#/components/schemas/Node'
        e:
            type: string
        property:
            type: object
            additionalProperties:
                $ref: '#/components/schemas/GoogleProtobufValue'
Status:
    type: object
    properties:
        code:
            type: integer
            description: The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].
            format: int32
        message:
            type: string
            description: A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.
        details:
            type: array
            items:
                $ref: '#/components/schemas/GoogleProtobufAny'
            description: A list of messages that carry the error details.  There is a common set of message types for APIs to use.
    description: 'The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).'
Command line used for generation
Steps to reproduce

Using this yaml in the online editor, the generated golang client codes have some bugs that I can't find the right type for google.protobuf.Value and google.protobuf.Any.

Related issues/PRs
Suggest a fix/enhancement

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

Reproduce the issue in the online Swagger Editor using the OpenAPI YAML shown, then inspect the generated Golang client around google.protobuf.Value and google.protobuf.Any. Confirm how those schema references are represented in the generated client and document or test the expected Go types.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.