Skip to content

Make array work at top level of an API #477

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

Closed
rudranil-das opened this issue Apr 21, 2025 · 0 comments · Fixed by #478
Closed

Make array work at top level of an API #477

rudranil-das opened this issue Apr 21, 2025 · 0 comments · Fixed by #478
Assignees

Comments

@rudranil-das
Copy link

rudranil-das commented Apr 21, 2025

Version information
openapiart==0.3.24

Describe the bug
Please refer to the models PR: open-traffic-generator/models#421 where two new apis (append_config, delete_config) are added both of which have an array at top level of the api. With this the generated go-snappi code does not have any accessor to the underlying objects (array-items). Snippet as mentioned below,

type ConfigAppend interface {
	Validation
	// msg marshals ConfigAppend to protobuf object *otg.ConfigAppend
	// and doesn't set defaults
	msg() *otg.ConfigAppend
	// setMsg unmarshals ConfigAppend from protobuf object *otg.ConfigAppend
	// and doesn't set defaults
	setMsg(*otg.ConfigAppend) ConfigAppend
	// provides marshal interface
	Marshal() marshalConfigAppend
	// provides unmarshal interface
	Unmarshal() unMarshalConfigAppend
	// validate validates ConfigAppend
	validate() error
	// A stringer function
	String() string
	// Clones the object
	Clone() (ConfigAppend, error)
	validateToAndFrom() error
	validateObj(vObj *validation, set_default bool)
	setDefault()
}

The only way to get around this is to have an object at the top level of api and push the array under it.
But that creates an additional (and likely unnecessary) redirection to the intermediate object before an item could be added to the array. This applies to both the mentioned apis in discussion.

To Reproduce
Get the generated go-snappi from the branch in mentioned models PR.

Expected behavior
The accessor(s) to the underlying array-items should be available without the inclusion of intermediate object.

Additional context
Add any other context about the problem here.

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.

2 participants