You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am encountering an issue when binding date query parameters in a Gin-Gonic application. The problem arises when using oapi-codegen to generate models that include a date query parameter.
Steps to Reproduce
OpenAPI Specification: I defined a date query parameter in my OpenAPI specification as follows:
- name: date_fromin: queryschema:
type: stringformat: date
Generated Go Model: Using oapi-codegen, the above specification generates a Go struct resembling:
Error Received: invalid character '-' after top-level value
Expected Behavior
I expect the date_from query parameter to be bound successfully to the Params struct without errors, parsing the date string correctly.
Actual Behavior
The binding process fails with an error indicating an issue with the '-' character in the date string, which suggests a possible problem with how the date string is being parsed or handled during the binding process.
Additional Information
Gin-Gonic Version: v1.9.1
oapi-codegen Version: v2.0.0
oapi-codegen/runtime Version: v1.1.0
Go Version: go1.21.4
The text was updated successfully, but these errors were encountered:
Description
I am encountering an issue when binding date query parameters in a Gin-Gonic application. The problem arises when using
oapi-codegen
to generate models that include a date query parameter.Steps to Reproduce
OpenAPI Specification: I defined a date query parameter in my OpenAPI specification as follows:
Generated Go Model: Using
oapi-codegen
, the above specification generates a Go struct resembling:Binding in Gin-Gonic: When I attempt to bind this query parameter using Gin's
BindQuery
method, I encounter an error./endpoint?date_from=2023-01-01
invalid character '-' after top-level value
Expected Behavior
I expect the
date_from
query parameter to be bound successfully to theParams
struct without errors, parsing the date string correctly.Actual Behavior
The binding process fails with an error indicating an issue with the '-' character in the date string, which suggests a possible problem with how the date string is being parsed or handled during the binding process.
Additional Information
The text was updated successfully, but these errors were encountered: