Skip to content

Generation Error after Upgrading to v1.12.0 or v1.11.0 - generation fails with a conflict. #1448

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

Open
TomerHeber opened this issue Apr 19, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@TomerHeber
Copy link

What version of ogen are you using?

1.12.0 and 1.11.0

Can this issue be reproduced with the latest version?

Yes (with my spec file)

What did you do?

I attempted to generate code from the spec file.

//go:generate go run github.com/ogen-go/ogen/cmd/ogen --target ./client -package client --clean openapi.json

What did you expect to see?

Successful code generation.
Code generation is successful in version github.com/ogen-go/ogen v1.10.1
degradation occurred between v1.10.1 and v1.11.0

What did you see instead?

generate:
    main.run
        /Users/tomerheber/go/pkg/mod/github.com/ogen-go/[email protected]/cmd/ogen/main.go:378
  - build IR:
    main.generate
        /Users/tomerheber/go/pkg/mod/github.com/ogen-go/[email protected]/cmd/ogen/main.go:71
  - make ir:
    github.com/ogen-go/ogen/gen.NewGenerator
        /Users/tomerheber/go/pkg/mod/github.com/ogen-go/[email protected]/gen/generator.go:110
  - operations:
    github.com/ogen-go/ogen/gen.(*Generator).makeIR
        /Users/tomerheber/go/pkg/mod/github.com/ogen-go/[email protected]/gen/generator.go:128
  - anonymous type name conflict: "OptSecretConfig":
    github.com/ogen-go/ogen/gen.(*tstorage).merge
        /Users/tomerheber/go/pkg/mod/github.com/ogen-go/[email protected]/gen/tstorage.go:180

@TomerHeber TomerHeber added the bug Something isn't working label Apr 19, 2025
@TomerHeber TomerHeber changed the title Conflict: After Upgrading to v1.12.0 or v1.11.0 generation fails with a conflict. Generation Error after Upgrading to v1.12.0 or v1.11.0 - generation fails with a conflict. Apr 19, 2025
@TomerHeber
Copy link
Author

TomerHeber commented Apr 19, 2025

I suspect this might be the root cause:
#1338 #1444

@mxk
Copy link

mxk commented May 9, 2025

I'm not sure if the root cause is the same, but I'm getting a similar error for the example below (make ir: operations: anonymous type name conflict: "OptObj"). Removing "nullable": true, for Obj fixes the error.

{
  "openapi": "3.0.3",
  "info": {
    "version": "latest"
  },
  "paths": {
    "/v1": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Nullable"
                }
              }
            }
          }
        }
      }
    },
    "/v2": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotNullable"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Obj": {
        "nullable": true,
        "type": "object"
      },
      "Nullable": {
        "nullable": true,
        "type": "object",
        "properties": {
          "obj": {
            "$ref": "#/components/schemas/Obj"
          }
        }
      },
      "NotNullable": {
        "type": "object",
        "properties": {
          "obj": {
            "$ref": "#/components/schemas/Obj"
          }
        }
      }
    }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants