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

Fix handling of "empty" types #1474

Closed
matthchr opened this issue Jun 1, 2020 · 8 comments · Fixed by Azure/k8s-infra#295 or #2697
Closed

Fix handling of "empty" types #1474

matthchr opened this issue Jun 1, 2020 · 8 comments · Fixed by Azure/k8s-infra#295 or #2697
Assignees
Milestone

Comments

@matthchr
Copy link
Member

matthchr commented Jun 1, 2020

There are a number of these that are due to conversion from Swagger where all of the fields of a type are read-only:

For example:

  1. https://schema.management.azure.com/schemas/2019-03-01/Microsoft.Compute.Galleries.json
    • GalleryProperties.Identifier
  2. https://schema.management.azure.com/schemas/2019-07-01/Microsoft.Compute.json
    • VirtualMachineIdentity.UserAssignedIdentities
      Both of the above are types that are entirely readonly

This causes at least a few errors when controller-gen runs that come out looking like this:

/home/matthchr/work/github/k8s-infra/hack/generator/apis/microsoft.compute.galleries/v20180601/galleries_types.go:75:15: unsupported AST kind *ast.InterfaceType
@matthchr
Copy link
Member Author

matthchr commented Jun 1, 2020

@Porges suggests that we could possibly limit our interpretation of what constitutes an allowable generic object to ones that are used with a field of tags or something (@matthchr note: I would've thought tags would just be a map[string]string though)

@Porges
Copy link
Member

Porges commented Jun 2, 2020

GalleryIdentifier doesn’t even have a type so that is something we can’t generate properly (I assume it is meant to be string).

@matthchr
Copy link
Member Author

matthchr commented Jun 2, 2020

It's a complex type with a single read-only property according to Swagger.

It looks like the JSON schema code generator just makes it out to be a really weird object because it's all readonly.

@babbageclunk babbageclunk self-assigned this Jul 22, 2020
@babbageclunk
Copy link
Member

This isn't exactly fixed by Azure/k8s-infra#203 but is side-stepped a little - we exclude all of the packages that generate interface{}. That lets us generate and controller-gen the other packages into something that builds successfully.

@matthchr
Copy link
Member Author

matthchr commented Mar 1, 2021

This was un-fixed with the introduction of support for map[string]v1.JSON types. Unfortunately I am not sure how to differentiate between "this type is empty because all of its properties are readonly" and "this type is empty because we accept anything"

We may need the Swagger data.

@matthchr matthchr reopened this Mar 1, 2021
@Porges Porges transferred this issue from Azure/k8s-infra May 14, 2021
@theunrepentantgeek theunrepentantgeek added this to the codegen-alpha-1 milestone Jul 5, 2021
@theunrepentantgeek
Copy link
Member

Moving to codegen-beta-0 milestone as we have a good-enough workaround for now (excluding the property); this may bite us later on though, so we still need to fix the issue.

@matthchr
Copy link
Member Author

matthchr commented Mar 7, 2022

Can we close this in favor of #2084 @Porges?

@matthchr
Copy link
Member Author

We still need to confirm that #2084 fixes this. I think it should but will leave this open until we can confirm.

@matthchr matthchr modified the milestones: v2.0.0-beta.1, v2.0.0-beta.2 Jun 13, 2022
@matthchr matthchr modified the milestones: v2.0.0-beta.3, v2.0.0-beta.5 Oct 24, 2022
@matthchr matthchr removed this from the v2.0.0-beta.5 milestone Jan 4, 2023
@matthchr matthchr added this to the v2.0.0 milestone Jan 4, 2023
@matthchr matthchr assigned matthchr and unassigned babbageclunk Jan 10, 2023
@matthchr matthchr moved this from Backlog to In Progress in Azure Service Operator Roadmap Jan 24, 2023
@matthchr matthchr moved this from In Progress to Up Next in Azure Service Operator Roadmap Jan 24, 2023
matthchr added a commit to matthchr/azure-service-operator that referenced this issue Jan 24, 2023
matthchr added a commit to matthchr/azure-service-operator that referenced this issue Jan 24, 2023
matthchr added a commit to matthchr/azure-service-operator that referenced this issue Jan 24, 2023
matthchr added a commit to matthchr/azure-service-operator that referenced this issue Jan 25, 2023
matthchr added a commit that referenced this issue Jan 25, 2023
@github-project-automation github-project-automation bot moved this from Up Next to Recently Completed in Azure Service Operator Roadmap Jan 25, 2023
@matthchr matthchr moved this from Recently Completed to Ready for Release in Azure Service Operator Roadmap Jan 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
4 participants