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

Bug: Code generation for diskAccess fails (v2) #1764

Closed
dseelinger opened this issue Aug 30, 2021 · 2 comments
Closed

Bug: Code generation for diskAccess fails (v2) #1764

dseelinger opened this issue Aug 30, 2021 · 2 comments
Labels
bug 🪲 Something isn't working

Comments

@dseelinger
Copy link

dseelinger commented Aug 30, 2021

Describe the bug
Running task to generate code fails after adding the diskAccess resource type.

To Reproduce
Steps to reproduce the behavior:

  • Add the following to the config azure-arm.yaml file:
  - action: include-transitive
    group: microsoft.compute
    version: v*api20200930
    name: diskAccess
    because: "including disk access"
  • Run task

Expected behavior
Successful code generation

Actual behavior

[controller:generate-types] failed during pipeline stage 27/46: Apply flattening to properties marked for flattening: visit of type of "github.com/Azure/azure-service-operator/hack/generated/apis/microsoft.compute/v1alpha1api20200930/DiskAccesses_Spec" failed: flatten applied to non-object type: map[string]k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1/JSON
task: Failed to run task "controller:quick-checks": task: Failed to run task
@dseelinger dseelinger added the bug 🪲 Something isn't working label Aug 30, 2021
@matthchr
Copy link
Member

matthchr commented Aug 30, 2021

Thanks for filing this.

The problem is that the DiskAccess "properties" field is actually entirely readonly. This is related to #1474 which is in turn related to Azure/azure-resource-manager-schemas#835.

A fix for this is to include

typeTransformers:
  ...
  # Deal with readonly properties that were not properly pruned in the JSON schema
  ...
  - group: microsoft.compute
    version: v*api20200930
    name: DiskAccesses_Spec
    property: Properties
    remove: true
    because: it has no writable properties in swagger

in the config

@matthchr
Copy link
Member

Closing this as the posted workaround works (confirmed over Teams) and the underlying issue is already being tracked by #1474

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