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

Make inlined structs get references from where they are inlined #31

Closed
mikaello opened this issue Jul 15, 2022 · 0 comments · Fixed by #33
Closed

Make inlined structs get references from where they are inlined #31

mikaello opened this issue Jul 15, 2022 · 0 comments · Fixed by #33

Comments

@mikaello
Copy link
Contributor

In light of the recently merged PR #25 , adding support for inlined types, we are seeing something we regard as an inconsistency.

When having a struct inlined into another, I would expect that types in the original struct having references to both original struct, but also the struct it is inlined into (having reference to == being in the list of Appears in). Example:

// +kubebuilder:object:root=true
type Embedded struct {
	A string `json:"a,omitempty"`
	Embedded1 `json:",inline"`
}
type Embedded1 struct {
	EmbeddedX `json:",inline"`
	B string `json:"b,omitempty"`
}
type EmbeddedX struct {
	C string `json:"c,omitempty"`
}

I would expect an output similar to

[id="{anchor_prefix}-github-com-elastic-crd-ref-docs-api-v1-embedded"]
==== Embedded

|===
| Field | Description
| *`apiVersion`* __string__ | `webapp.test.k8s.elastic.co/v1`
| *`kind`* __string__ | `Embedded`
| *`a`* __string__ |
| *`c`* __string__ |
| *`b`* __string__ |
|===



[id="{anchor_prefix}-github-com-elastic-crd-ref-docs-api-v1-embedded1"]
==== Embedded1

.Appears In:
****
- xref:{anchor_prefix}-github-com-elastic-crd-ref-docs-api-v1-embedded[$$Embedded$$]
****

|===
| Field | Description
| *`c`* __string__ |
| *`b`* __string__ |
|===



[id="{anchor_prefix}-github-com-elastic-crd-ref-docs-api-v1-embeddedx"]
==== EmbeddedX

.Appears In:
****
- xref:{anchor_prefix}-github-com-elastic-crd-ref-docs-api-v1-embedded[$$Embedded$$]
- xref:{anchor_prefix}-github-com-elastic-crd-ref-docs-api-v1-embedded1[$$Embedded1$$]
****

|===
| Field | Description
| *`c`* __string__ |
|===

Where you can see that EmbeddedX having both Embedded1 and Embedded2 in it's Appears in list. The current situation is that EmbeddedX only has Embedded1 in its Appears in list.

What do you think? I would be happy to submit a PR for this if you agree this is how the behaviour should be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant