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

feat(router): lua validate an expression against a schema #39

Merged
merged 29 commits into from May 11, 2023
Merged

Conversation

pluveto
Copy link
Contributor

@pluveto pluveto commented Feb 13, 2023

Feature to validate an expression against a given schema.

syntax: ok, err = r.validate(schema, expr)

context: any

Returns true when the expression is valid.

If the expression is invalid,
nil and a string describing the reason will be returned.

KAG-1524

@chronolaw chronolaw changed the title feat: lua validate an expression against a schema feat(router): lua validate an expression against a schema Feb 13, 2023
t/06-validate.t Outdated Show resolved Hide resolved
t/06-validate.t Show resolved Hide resolved
@hbagdi
Copy link
Member

hbagdi commented Feb 22, 2023

ping @dndx

lib/resty/router/router.lua Outdated Show resolved Hide resolved
lib/resty/router/router.lua Outdated Show resolved Hide resolved
@hbagdi
Copy link
Member

hbagdi commented Apr 5, 2023

ping @pluveto @chronolaw

@chronolaw
Copy link
Contributor

This PR is ready for merge, it just needs a final review.

@hbagdi
Copy link
Member

hbagdi commented Apr 6, 2023

@chronolaw Please perform the final review and let's merge.

@chronolaw
Copy link
Contributor

We should also add a description in readme.md.

@pluveto
Copy link
Contributor Author

pluveto commented Apr 23, 2023

We should also add a description in readme.md.

done

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
lib/resty/router/router.lua Outdated Show resolved Hide resolved
lib/resty/router/router.lua Outdated Show resolved Hide resolved
@chronolaw chronolaw force-pushed the feat/validate branch 2 times, most recently from ec405ba to 3b0f471 Compare April 28, 2023 03:15
@chronolaw
Copy link
Contributor

chronolaw commented May 8, 2023

I applied this PR to v1.0.5, and found that all ci tests passed.

I think perhaps some dependency upgrade causes the regex behavior is different from v 1.0.5.

After some tries, I found that the dependency regex 1.7.1 is ok, but regex 1.8.1 will cause ci to fail.

@chronolaw
Copy link
Contributor

In Rust regex crate, 1.8.0 changed a escape behavior, see: rust-lang/regex#501.

@chronolaw chronolaw force-pushed the feat/validate branch 4 times, most recently from 437a5d4 to e5b5c30 Compare May 9, 2023 09:24
@chronolaw chronolaw force-pushed the feat/validate branch 2 times, most recently from 2c0648c to 5c15238 Compare May 10, 2023 01:01
README.md Outdated Show resolved Hide resolved
@dndx dndx merged commit 3e7cdb5 into main May 11, 2023
7 checks passed
@dndx dndx deleted the feat/validate branch May 11, 2023 06:25
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

Successfully merging this pull request may close these issues.

None yet

5 participants