I was testing api generated by this tool where the schema used the declaration something like this in a response struct:
EmailAddress *openapi_types.Email json:"email_address,omitempty"
However, when the response contains an empty email field , the regex matcher does not fit so unmarshalling stop with panic.
I am not sure if this is the intended behaviour in the above case.
Anyway, the solution would be simply put a length check before regex validation, here:
https://github.com/deepmap/oapi-codegen/blob/master/pkg/types/email.go#L11
I was testing api generated by this tool where the schema used the declaration something like this in a response struct:
EmailAddress *openapi_types.Email
json:"email_address,omitempty"However, when the response contains an empty email field , the regex matcher does not fit so unmarshalling stop with panic.
I am not sure if this is the intended behaviour in the above case.
Anyway, the solution would be simply put a length check before regex validation, here:
https://github.com/deepmap/oapi-codegen/blob/master/pkg/types/email.go#L11