Skip to content

Commit daebe14

Browse files
committed
externalize gengo alias issue.
1 parent cf3137e commit daebe14

File tree

1 file changed

+8
-9
lines changed
  • keps/sig-api-machinery/2887-openapi-enum-types

1 file changed

+8
-9
lines changed

keps/sig-api-machinery/2887-openapi-enum-types/README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -351,15 +351,14 @@ const (
351351

352352
Here, `StorageMedium` can have infinite number of possible values, which disqualify it as an enum type.
353353

354-
The Go parser has a limitation on parsing type aliases. The parser cannot distinguish
355-
between the original definition and its aliases. For example,
356-
```go
357-
type Foo string
358-
type FooAlias = Foo
359-
```
360-
would result in the parser to treat FooAlias and Foo as the same type.
361-
As a result, `gengo` produce either `Foo` or `FooAlias` but not both.
362-
As a workaround, during beta graduation, the enum parser will be updated to accept any name of the type.
354+
The parser of Go compiler and, as a result, `gengo`, does not support type aliases. See https://github.com/kubernetes/gengo/issues/224 for details.
355+
As of Kubernetes 1.23, we do not have any type aliases in kubernetes/kubernetes repo. Any attempt to add aliases would break the code generation.
356+
Example: https://github.com/kubernetes/kubernetes/pull/106300
357+
358+
However, as of 1.23, the enum marker is the only marker to be added to a type declaration, and would be the first marker to be affected.
359+
Until there is a fix to `gengo`, the enum generator has the following limitations:
360+
- the enum marker must not be added to aliases
361+
- an aliased enum type or value SHOULD NOT have comments. Otherwise, the comments will be squashed with these of the original with undefined ordering.
363362

364363
### Risks and Mitigations
365364

0 commit comments

Comments
 (0)