-
Notifications
You must be signed in to change notification settings - Fork 542
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: expose JSON Schema through API #1592
Conversation
also cc @guoqqqi to review |
Codecov Report
@@ Coverage Diff @@
## master #1592 +/- ##
==========================================
+ Coverage 71.46% 72.58% +1.12%
==========================================
Files 132 86 -46
Lines 5375 2356 -3019
Branches 592 592
==========================================
- Hits 3841 1710 -2131
+ Misses 1290 646 -644
+ Partials 244 0 -244
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work 👍
Just minor changes
"github.com/onsi/ginkgo" | ||
"github.com/onsi/ginkgo/extensions/table" | ||
|
||
"e2enew/base" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e2enew module path has been updated in #1578
"e2enew/base" | |
"github.com/apisix/manager-api/test/e2enew/base" |
why this PR will decrease coverage by 12.25%? |
Because the coverage of the last PR merged into the master only counts the coverage of And in this PR it’s calculated We have contacted codecov to see if we can solve this unstable problem. |
if res, ok := conf.Plugins[pluginName]; !ok || !res { | ||
continue | ||
if pluginName != "serverless-post-function" && pluginName != "serverless-pre-function" { | ||
ret = append(ret, pluginName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic had changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
@@ -23,5 +23,5 @@ import ( | |||
) | |||
|
|||
func TestPlugin(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename to TestSchema?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@LiteSun Help looks at the Frontend CI. |
OK, I will check it. |
func (h *SchemaHandler) Schema(c droplet.Context) (interface{}, error) { | ||
input := c.Input().(*SchemaInput) | ||
|
||
ret := conf.Schema.Get("main." + input.Resource).Value() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wht not return an error like "schema not found" when the schema doesn't exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated. thanks.
table.DescribeTable("test plugin basic", func(testCase base.HttpTestCase) { | ||
base.RunTestCase(testCase) | ||
}, | ||
table.Entry("get all plugins", base.HttpTestCase{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep the indent aligned with table.DescribeTable
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, this is formatted by go fmt
@tokers
FE CI failed and I will check it. https://github.com/apache/apisix-dashboard/pull/1592/checks?check_run_id=2126651425 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😆👍
Please answer these questions before submitting a pull request
Why submit this pull request?
Bugfix
New feature provided
Improve performance
Backport patches
Related issues
close feat: support exposing schema of route, upstream, service and ssl through Manager API #1450
New feature or improvement
The APISIX ingress controller needs to use the json schema (dashboard FE or other projects may also need it), and it still use the admin api interface.
At present, the manager api only supports to expose the json schema of plugins.
so we now support exposing JSON Schema of all resources and plugins through API
Please add the corresponding test cases if necessary.
added.