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

Improve file layout for generated types #1588

Closed
matthchr opened this issue Jun 21, 2021 · 10 comments
Closed

Improve file layout for generated types #1588

matthchr opened this issue Jun 21, 2021 · 10 comments

Comments

@matthchr
Copy link
Member

matthchr commented Jun 21, 2021

Describe the current behavior
Today we lay the files out with all the methods for types in the same file as the types. ARM types are in the same package as the Kubernetes types. It's a bit messy.

Describe the improvement
The following ideas were discussed:

  1. Move ARM types into a subpackage
  2. Possibly split types from methods on types - or maybe just some of the methods on types (i.e. defaulting stuff could go into its own file?)
  3. Combine spec and status types for the ARM types?
@matthchr matthchr added the task label Jun 21, 2021
@matthchr matthchr added this to the codegen-beta milestone Jun 21, 2021
@theunrepentantgeek
Copy link
Member

I strongly prefer keeping methods in the same file with the associated types - a legacy of having to play far too much mystery file exploration on prior projects, hunting for the implementation of a particular method to see what it does (and this was in C# projects where I only had to contend with partial classes and extension methods, and I had Visual Studio for navigation, not Go where literally every function can appear somewhere different in the package).

I agree with moving the ARM variants into a subpackage, as that makes it clear that they're an implementation detail that can be ignored by other consumers of the types.

I thought our file-type allocation approach was to start with a resource and put all the types it references into the same file - so I wonder why we're getting Spec and Status types elsewhere.

@theunrepentantgeek
Copy link
Member

Can we move the ARM types into a subpackage?

The API types need to reference the ARM types when they implement CreateEmptyARMValue() and related conversion routines.

Is there anything on the ARM types that requires referencing the API ones?

@matthchr
Copy link
Member Author

@theunrepentantgeek AFAIK no, there should not be references from the ARM types to the Kube types. The ARM types are the "SDK" for interacting with Azure and should in theory be able to stand alone.

@theunrepentantgeek
Copy link
Member

We are still interested in improvements here.

@Porges suggested moving the spec and status types into separate subpackages, which would also allow us to simplify type naming.

@theunrepentantgeek
Copy link
Member

Still interested.

@matthchr
Copy link
Member Author

This isn't super critical but it's something we're still tracking

@matthchr matthchr modified the milestones: v2.4.0, v2.3.0 Jul 24, 2023
@matthchr
Copy link
Member Author

Moved this into 2.3 as it's related to some work that @theunrepentantgeek is working on. We may want to update this and/or close it and make a more focused item for work that we have remaining after the upcoming changes.

@matthchr matthchr modified the milestones: v2.3.0, v2.4.0 Aug 28, 2023
@theunrepentantgeek theunrepentantgeek modified the milestones: v2.5.0, v2.4.0 Sep 7, 2023
@matthchr matthchr modified the milestones: v2.4.0, v2.5.0 Oct 23, 2023
@theunrepentantgeek theunrepentantgeek modified the milestones: v2.6.0, v2.7.0 Dec 11, 2023
@matthchr matthchr removed this from the v2.7.0 milestone Feb 22, 2024
@matthchr
Copy link
Member Author

No change from the above

@matthchr matthchr added this to the v2.8.0 milestone Mar 18, 2024
@matthchr
Copy link
Member Author

We've moved this into 2.8.0, it seems like it should be pretty easy now with the infrastructure work that @theunrepentantgeek added.

@theunrepentantgeek
Copy link
Member

I've split the remaining work into new issues.

@github-project-automation github-project-automation bot moved this from Backlog to Recently Completed in Azure Service Operator Roadmap Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

2 participants