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

net/goai: Operation object info improvement #3889

Open
UncleChair opened this issue Oct 24, 2024 · 1 comment · May be fixed by #3896
Open

net/goai: Operation object info improvement #3889

UncleChair opened this issue Oct 24, 2024 · 1 comment · May be fixed by #3896

Comments

@UncleChair
Copy link
Contributor

Description

@gqcn Currently GoFrame are using tags for openapi doc generation, most functions are fully functional and very helpful. But when adding some tags like security, there always needs to add a serialized json string, which is large and would makes the structure less readable. And too many tags would also have the same problem. Therefore, would it possible to add an interface for xxxReq to add a HOOK in the openapi doc generation process? Like we could add some functions here before using the generated operation object:

oai.removeOperationDuplicatedProperties(operation)

if enhancedRequest, ok := outputObject.Interface().(ResponseStatusDef); ok {
    enhancedRequest.someHooker(&operation)
}

This could also cover some existing features that tags offers, but users could change the operation object directly in the hook function and override some info without limitations, making modifying openapi doc much easier and have more flexibility with some special needs. Also it could help reduce the tags info in the structure design that are not related to the real business info. And as the original design, the goai pack would provide 80% usage case, users could have this interface to change the doc in some edge cases.

While indeed, this feature has some duplication with what tags offers, but since it could be a much higher level operation, may be it could be added? Hoping to get your opinion for the framework perspective.

Additional

No response

@UncleChair
Copy link
Contributor Author

Added an override hook for goai config, should be better than adding for each req or res

@UncleChair UncleChair changed the title net/goai: Request/Response info improvement net/goai: Operation object info improvement Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant