Skip to content

feat: add schema validate admin API#10065

Merged
juststillthinking merged 7 commits into
apache:masterfrom
kingluo:admin-api-schema-validate
Aug 22, 2023
Merged

feat: add schema validate admin API#10065
juststillthinking merged 7 commits into
apache:masterfrom
kingluo:admin-api-schema-validate

Conversation

@kingluo

@kingluo kingluo commented Aug 21, 2023

Copy link
Copy Markdown
Contributor

Description

https://lists.apache.org/thread/6lsbhh4c9ytjmrkr0jt66j5s4vyh482k

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

@kingluo
kingluo marked this pull request as ready for review August 21, 2023 09:15

@moonming moonming left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we need more test cases to cover invalid requests.

"scheme": "https",
"type": "roundrobin",
"nodes": {
"nghttp2.org": 1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
"nghttp2.org": 1
"httpbin.org": 1

@kingluo kingluo Aug 21, 2023

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

httpbin has been less stable in recent months, and now the community is using nghttp2 more.
Also, regarding schema checking, what matters here is not the actual value, but the type.

@tao12345666333 tao12345666333 Aug 22, 2023

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

yes.

FYI We can use httpbun.org also

This does not affect this PR

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

how about https://mock.api7.ai/?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@moonming SGTM.

Comment thread t/admin/schema-validate.t
"scheme": "https",
"type": "roundrobin",
"nodes": {
"nghttp2.org": 1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ditto

Comment thread t/admin/schema-validate.t
"scheme": "https",
"type": "roundrobin",
"nodes": {
"nghttp2.org": 1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ditto

@moonming
moonming requested review from Revolyssup and kayx23 August 21, 2023 13:03
Revolyssup
Revolyssup previously approved these changes Aug 21, 2023

@Revolyssup Revolyssup left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

Comment thread docs/en/latest/admin-api.md Outdated
Comment thread docs/en/latest/admin-api.md Outdated
Comment thread docs/en/latest/admin-api.md Outdated
Co-authored-by: Abhishek Choudhary <[email protected]>
kingluo and others added 2 commits August 21, 2023 23:54
Co-authored-by: Abhishek Choudhary <[email protected]>
Co-authored-by: Abhishek Choudhary <[email protected]>
@kayx23

kayx23 commented Aug 22, 2023

Copy link
Copy Markdown
Member

Just a question: why not doing the schema check automatically before users sending requests to any Admin API endpoints? The current approach, that is to ask users to send requests to a specific /validate endpoint, feels rather manual.

@moonming moonming left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we need more test cases not only in routes

@moonming

Copy link
Copy Markdown
Member

Just a question: why not doing the schema check automatically before users sending requests to any Admin API endpoints? The current approach, that is to ask users to send requests to a specific /validate endpoint, feels rather manual.

The user's request already run the schema check.
The purpose of this API is only to check the schema of requests, no more no less.

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.

7 participants