-
Notifications
You must be signed in to change notification settings - Fork 623
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
Add support for Get/Post/Delete/Patch schemas for API Shield Schema Validation 2.0 #1406
Conversation
7bf2329
to
d4a865a
Compare
changelog detected ✅ |
ed05bd6
to
c8bfbf3
Compare
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.
This looks good to me!
api_shield_schemas.go
Outdated
uri := fmt.Sprintf("/zones/%s/api_gateway/user_schemas", rc.Identifier) | ||
|
||
if params.Name == "" { | ||
return nil, fmt.Errorf("params.Name must not be empty") |
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.
Name can in principle be empty, is this specific to Terraform? If it is empty, the file-name will be used
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.
Ah but I guess here we do not have a filename
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.
We don't have a filename in this case as we're passing io.Reader
so a name should be provided separately.
var b bytes.Buffer | ||
w := multipart.NewWriter(&b) | ||
// write fields | ||
if err := w.WriteField("name", params.Name); err != nil { |
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.
Should we have a check that the name ends in .json
or .yaml
?
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.
On the backend it's not specified as a requirement so I don't think we should encode any logic like that here.
c8bfbf3
to
5033f86
Compare
…eld Schema Validation 2.0 This change adds support for the following API Shield related endpoints related to Schema Validation 2.0: - Retrieve information about all schemas on a zone - Retrieve information about a specific schema on a zone - Upload a schema to a zone - Enable validation for a schema - Delete a schema
5033f86
to
30c87b4
Compare
PR is ready for review after documentation update: https://developers.cloudflare.com/api/operations/api-shield-schema-validation-retrieve-information-about-all-schemas |
This functionality has been released in v0.79.0. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
This change adds support for the following API Shield related endpoints related to Schema Validation 2.0:
Description
This change adds support for API Shield related endpoints related to managing schemas for API Shield Schema Validation 2.0. This is so they can be used from the library and will enable this feature to be added to terraform in the future.
Has your change been tested?
Types of changes
What sort of change does your code introduce/modify?
Checklist:
and relies on stable APIs. (API Shield Schema Validation 2.0)