Skip to content

fix: remove \ from \\ in regex patterns for @Pattern annotation#134

Merged
derberg merged 2 commits intoasyncapi:masterfrom
micromata:bugfix/#122
Jun 17, 2021
Merged

fix: remove \ from \\ in regex patterns for @Pattern annotation#134
derberg merged 2 commits intoasyncapi:masterfrom
micromata:bugfix/#122

Conversation

@tuxBurner
Copy link
Contributor

Description

when having a regex with \ in pattern the openapi removes it from it.

For example having in the yaml:

time:
      type: "string"
      pattern: "^\\d\\d:\\d\\d$"

will result in the java code to:

@JsonProperty("time")@NotNull@Pattern(regexp="^\d\d:\d\d$")
public String getTime() {
    return time;
}

but should be:

@JsonProperty("time")@NotNull@Pattern(regexp="^\\d\\d:\\d\\d$")
public String getTime() {
    return time;
}

Related issue(s)
Resolves #122

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request.

Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

@tuxBurner tuxBurner changed the title Fixed removed \ from \\ in regex patterns fix:Fixed removed \ from \\ in regex patterns Jun 8, 2021
@derberg
Copy link
Member

derberg commented Jun 14, 2021

LGTM, can you please fix the PR title @tuxBurner

@tuxBurner tuxBurner changed the title fix:Fixed removed \ from \\ in regex patterns fix: Fixed removed \ from \\ in regex patterns Jun 17, 2021
@tuxBurner tuxBurner changed the title fix: Fixed removed \ from \\ in regex patterns fix: fixed removed \ from \\ in regex patterns Jun 17, 2021
@tuxBurner
Copy link
Contributor Author

LGTM, can you please fix the PR title @tuxBurner

Okay i hope this is okay now :)

@derberg derberg changed the title fix: fixed removed \ from \\ in regex patterns fix: remove \ from \\ in regex patterns for @Pattern annotation Jun 17, 2021
@derberg
Copy link
Member

derberg commented Jun 17, 2021

@tuxBurner changed a bit, I hope you don't mind

@derberg derberg merged commit a1f3466 into asyncapi:master Jun 17, 2021
@asyncapi-bot
Copy link
Contributor

🎉 This PR is included in version 0.23.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

invalid render regexp value for javax.validation.constraints.@Pattern annotation of models

3 participants