* modules/openapi-generator/src/main/resources/go-server: alternative initialization of variable, to avoid extra checks and custom code
* propagated changes to samples
Currently when a parsing rule of a field is not respected (eg: min/max
value, required, ...), the api only returns an error message without
providing the field name to help the user to fix the request. This commit
add the field name to the error message to help the user of the API.
* Uses ParseQuery to check for malform paramater value pairs.
Runs ./mvnw clean package, ./bin/generate-samples.sh ./bin/configs/*.yaml, and ./bin/utils/export_docs_generators.sh.
* Adds missing import
* Only import url if hasQueryParams.
* Adds helper function to wrap url.ParseQuery.
* Fixes function return signature
* [go-server] Support min/max/defaults for values
Enforce, for the go-server, to check the minimum and maximum values
specified in the openapi description. Also apply the default if the
parameter is not passed.
Fix#14013
* Fix merge conflict
Co-authored-by: Ween Jiann <16207788+lwj5@users.noreply.github.com>
* Improve UnmarshalJSON implementation
Co-authored-by: Ween Jiann <16207788+lwj5@users.noreply.github.com>
* Improve default value handling for string
Co-authored-by: Ween Jiann <16207788+lwj5@users.noreply.github.com>
* Fix suggested changes
* rework option pattern
* add imports based on types/min max values
---------
Co-authored-by: Ween Jiann <16207788+lwj5@users.noreply.github.com>
* Add apiNameSuffix to AbstractGoCodegen
* Regenerate files
* Update tests
* Regenerate files
* Update test files
* Regenerate for CI test
* Regenerate for CI test
* Remove some docs
* Add files back
* Added int arrays parsing in parameters. Respect the 'required' property.
* Replaced spaces with tabs
* Generate samples with new spacing
* Removed unused import
* Merged with latest master
* Add bool query in example
* Add parseBoolParameter
* test with boolean parameter
* add endpiont for testing boolean
* remove bool parameter test
Co-authored-by: Stéphane Guillemot <gmtstephane@gmail.com>
Update the go server api controller template to return the Router interface instead of the api specific router.
The Router interface type has the Routes function, which is what the generated `NewRouter` function needs. (not the api specific interface).
* Enhance go api server with interfaces router binding and services
Enhance the default go api server generation to define interfaces for an API's routes and services. Handle an endpoint's http binding in the generated router and the skeleton for the service logic in an API service.
* Include interface documentation in Go Server generation.