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
* If a form param is an array and isn't caught in the previous checks, treat it as a slice of strings.
* Add an example of a FormParam that is an array
* Add support for DateTime objects in the Path, Query Params, and as a List
* Fix indentation
* Add an exaple that has dateTimes
Move the date parsing into a common util in the routers.go file.
* Fix compilation issue and regen
* Use the `RequiredError` to handle this case
* Only split on a "," and not an extra 'space' after the ",".
* Support for an endpoint returning a file to a client.
* Spaces to tabs conversion
* Add an example endpoint for download a file
* Regenerate after merging main
* Add support for Enums to be part of the Path and Query
Supports optional Query Enums and Lists of Enums as well
Add an example endpoint that covers the added scenarios
Added an import mapping for the GoServerCodegen for "fmt"
when a model is an enum.
Expanded the Enum Model for the Go Server to have validation.
Copied this logic from the Go Client Enum Model.
* Fix identation of examples
* Pre-allocate the capacity of the slice of Enums to be
the correct size.
* Formatting and updated examples
* Empty-Commit
* Switch to using a map to store the valid enum values
* Fixed pointer derefs missed from previous change in PR
* More fixing of pointer to not pointer
* Create a map for validation and a list of enums for messaging
* Partitally reverts #15185
* Remove unused import
* Set zero value if param is empty
* Refactor samples, add test config
* Add tests
* Clean up
* Fix test
* [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
* Change the return type of a file back to a pointer
* Change the api template to handle not double pointer-ing return types of os.File
* Fix unit tests
* Couple more unit test fixes
* Changes manually cherry-picked (for the most part) from https://github.com/OpenAPITools/openapi-generator/pull/12685/files
* Examples updated post changes
* Missed a change in the mustache template
* Update examples after last fix
* Missed dereference for required files
* Update unit tests
* Missed another test case update
* `f := *f` isn't quite the same as `*f, err = ...`
* [go] More idiomatic godoc comments
* [go] Mark deprecated fields and functions
* [go] Minor mustache readability/consistency fixes
* [go] Mark deprecated operation parameters
* [go] Deprecate a petstore component property for testing
* [go] Apply deprecated godoc in Go servers also
According to the [documentation](https://openapi-generator.tech/docs/generators/go-server) the go-server generator should support an `addResponseHeaders` option but a template uses an `addResponseHeader` option in some places which this PR fixes.
Closes#9795
Signed-off-by: Max Goltzsche <max.goltzsche@gmail.com>
* 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>