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(admin) implement inferring, endpoint key and put support #3416

Merged
merged 3 commits into from
Apr 26, 2018

Conversation

bungle
Copy link
Member

@bungle bungle commented Apr 25, 2018

Summary

This PR enhances our new model autogenerated Admin API in several ways:

  1. It has more intelligent type inferring for application/x-www-form-urlencoded that takes into account information from schemas
  2. It adds support for endpoint_key parameter in schemas that can be pointed to any unique field (allows us to e.g. autogenerate /consumers/<uuid-or-username>)
  3. It adds proper PUT support (by <uuid> or by <schema.endpoint_key> (aka unique)

Issues resolved

Fix #3378

It will also close these when the respective entities are moved to new model:

Fix (or make obsolete) #3183
Fix (or make obsolete) #3168

it("infers nulls from empty strings, arrays or sets", function()
assert.equal(ngx.null, infer_value("", { type = "string" }))
assert.equal(ngx.null, infer_value("", { type = "array" }))
assert.equal(ngx.null, infer_value("", { type = "set" }))
Copy link
Member

@kikito kikito Apr 26, 2018

Choose a reason for hiding this comment

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

If feels weird that infer_value returns null when it encounters "" for arrays and sets, but not for maps or records (for which it returns "" instead)

@hishamhm, what is your opinion on this?

Copy link
Contributor

Choose a reason for hiding this comment

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

"" for maps and records should infer null as well.

@bungle bungle force-pushed the feat/admin-infer-and-endpoint-key-and-put branch 2 times, most recently from 80d6729 to 2de376b Compare April 26, 2018 21:18
@bungle bungle force-pushed the feat/admin-infer-and-endpoint-key-and-put branch from 2de376b to de7e0f4 Compare April 26, 2018 21:19
@bungle bungle added pr/ready This PR is considered ready and can be merged at anytime (given it received no subsequent changes) and removed pr/please review labels Apr 26, 2018
@bungle bungle merged commit da4e36b into next Apr 26, 2018
@bungle bungle deleted the feat/admin-infer-and-endpoint-key-and-put branch April 26, 2018 22:34
@Tieske
Copy link
Member

Tieske commented Apr 27, 2018

Nice! 👍

thibaultcha added a commit to Kong/docs.konghq.com that referenced this pull request May 11, 2018
thibaultcha pushed a commit to Kong/docs.konghq.com that referenced this pull request May 11, 2018
See Kong/kong#3416

Signed-off-by: Thibault Charbonnier <thibaultcha@me.com>
Tieske pushed a commit to Kong/docs.konghq.com that referenced this pull request May 28, 2018
See Kong/kong#3416

Signed-off-by: Thibault Charbonnier <thibaultcha@me.com>
thibaultcha pushed a commit to Kong/docs.konghq.com that referenced this pull request May 30, 2018
See Kong/kong#3416

Signed-off-by: Thibault Charbonnier <thibaultcha@me.com>
hbagdi pushed a commit to Kong/docs.konghq.com that referenced this pull request May 31, 2018
See Kong/kong#3416

Signed-off-by: Thibault Charbonnier <thibaultcha@me.com>
thibaultcha pushed a commit to Kong/docs.konghq.com that referenced this pull request Jun 28, 2018
See Kong/kong#3416

Signed-off-by: Thibault Charbonnier <thibaultcha@me.com>
ukiahsmith pushed a commit to Kong/docs.konghq.com that referenced this pull request Jul 2, 2018
See Kong/kong#3416

Signed-off-by: Thibault Charbonnier <thibaultcha@me.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr/ready This PR is considered ready and can be merged at anytime (given it received no subsequent changes)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants