Skip to content

gen: module version is not taken into account in package name by x-ogen-type #1495

@dzsibi

Description

@dzsibi

What version of ogen are you using?

github.com/ogen-go/ogen v1.14.1-0.20250710015620-72cb51bbb505

Can this issue be reproduced with the latest version?

Yes.

What did you do?

I tried using the new x-ogen-type extension by @abemedia (thanks for the great work!) with the JSONWebKey object in go-jose, but the generated code has compile time errors.

type: object
x-ogen-type: github.com/go-jose/go-jose/v3.JSONWebKey

What did you expect to see?

I expected code that:

  • imports the github.com/go-jose/go-jose/v3 package
  • references the type as jose.JSONWebKey

What did you see instead?

The generated code:

  • does not import the package
  • references the type as v3.JSONWebKey

Example:

func (s JSONWebKey) Encode(e *jx.Encoder) {
	unwrapped := v3.JSONWebKey(s)

	json.EncodeJSON(e, unwrapped)
}

Unfortunately, I did not see any escape hatches where I could override this behavior by explicitly specifying the package name or the import.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions