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

date-time regex allows timezone offset to be missing #1031

Open
bredelman opened this issue Nov 21, 2024 · 0 comments
Open

date-time regex allows timezone offset to be missing #1031

bredelman opened this issue Nov 21, 2024 · 0 comments

Comments

@bredelman
Copy link

I'm using this library in tandem with oapi codegen. I am validating a request with ?start_time\=2024-10-22T00:00:00-04:00 as a query param. The validation works fine but I was experimenting and removed the timezone offset and sent ?start_time\=2024-10-22T00:00:00 and that seems to make it past the validation from kin openapi and doesn't make it past the codegen generated validation for date-time.

In their library they do

// Time is a special case of a struct that we handle
			parsedTime, err := time.Parse(time.RFC3339Nano, src)
			if err != nil {
				parsedTime, err = time.Parse(types.DateFormat, src)
				if err != nil {
					return fmt.Errorf("error parsing '%s' as RFC3339 or 2006-01-02 time: %s", src, err)
				}
			}

time.Parse, so if I'm understanding this right, I think the regex needs to be strengthened to match that validation

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

No branches or pull requests

1 participant