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

fix(schema) catch properly when foreign keys are null #3548

Merged
merged 2 commits into from
Jun 15, 2018

Conversation

hishamhm
Copy link
Contributor

Thanks to @fffonion for reporting it and to @bungle for the fix!

Includes both a general regression test for the schema library and a regression test specific for the Routes entity.

@@ -858,7 +859,7 @@ function Schema:validate_primary_key(pk, ignore_others)
pk_set[k] = true
local field = self.fields[k]
local v = pk[k]
if not v then
if v == nil or v == null then
Copy link
Member

Choose a reason for hiding this comment

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

The only concern I have with this, is that if we have say plugins in new model that can have null in consumer_id, route_id, service_id, api_id, does this prevent that? Just double checking.

Copy link
Member

Choose a reason for hiding this comment

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

Likely, but I think we should address the concern when the issue arises, and refactor/add new attributes only then.

Thanks to @fffonion for reporting it and to @bungle for the feedback!

Includes both a general regression test for the schema library
and a regression test specific for the Routes entity.
@hishamhm hishamhm force-pushed the fix/schema-missing-primary-key branch from d0f51ea to a805dc9 Compare June 15, 2018 18:39
@thibaultcha thibaultcha merged commit c2b5fcc into master Jun 15, 2018
@thibaultcha thibaultcha deleted the fix/schema-missing-primary-key branch June 15, 2018 19:54
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.

3 participants