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

Add proper recursive handling for $ref resolution base #448

Merged

Conversation

erayd
Copy link
Collaborator

@erayd erayd commented Sep 30, 2017

What

Implement recursive resolution of $ref base.

Why

Because the existing code doesn't actually do this properly, and is various combinations of missing and not implemented in this area.

Note that this patch does not distinguish between schema and non-schema contexts; it just resolves $ref wherever it may occur within a schema. Limiting this to schema-context only may be added later.

ObjectIterator is not removed, despite now being redundant, as it's a handy class for people who wish to implement their own preprocessor for whatever reason.

@erayd
Copy link
Collaborator Author

erayd commented Sep 30, 2017

@shmax Any chance of a code review?

@erayd
Copy link
Collaborator Author

erayd commented Sep 30, 2017

Have rebased this on #449 - the latest version of php-cs-fixer introduces some dangerous changes, and also causes CI failures on travis. #449 should be merged prior to this PR.

@erayd erayd force-pushed the bugfix-447-id-relative-ref branch 2 times, most recently from eea58bd to b639049 Compare September 30, 2017 04:32
@shmax
Copy link
Collaborator

shmax commented Sep 30, 2017

LGTM 💯

Fixes justinrainbow#447

Note that this patch does not check whether a given container is
actually a schema when recursing into it. In most cases this will
not matter, however it does mean that in some edge cases it will
attempt to resolve a `$ref` in a context where ref is actually not
part of the spec. Limiting resolution to schema-context containers
is outside the scope of this patch, but can be added later.
@erayd erayd force-pushed the bugfix-447-id-relative-ref branch from b639049 to 737facf Compare October 2, 2017 19:20
@erayd
Copy link
Collaborator Author

erayd commented Oct 2, 2017

Rebased.

Copy link
Collaborator

@bighappyface bighappyface left a comment

Choose a reason for hiding this comment

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

+1 for 737facf

@bighappyface bighappyface merged commit 0a6210e into justinrainbow:6.0.0-dev Oct 2, 2017
erayd added a commit to erayd/json-schema that referenced this pull request Oct 3, 2017
…#448)

Fixes justinrainbow#447

Note that this patch does not check whether a given container is
actually a schema when recursing into it. In most cases this will
not matter, however it does mean that in some edge cases it will
attempt to resolve a `$ref` in a context where ref is actually not
part of the spec. Limiting resolution to schema-context containers
is outside the scope of this patch, but can be added later.
bighappyface pushed a commit that referenced this pull request Oct 3, 2017
* Update php-csfixer rules to address problem in 2.7 & new multiline rule (#449)

* Update php-csfixer rules to address problem in 2.7 & new multiline rule

 * yoda_style in 2.7 is dangerous and may result in logic errors. In
 some cases, it also results in invalid syntax.

 * multiline comments prefixed with // now seem to be misaligned, and
 this cannot be disabled, so have changed the relevant comment.

* PHP-5.3 is not available on trusty, so explicitly specify precise for 5.3

* Add proper recursive handling for $ref resolution base (#448)

Fixes #447

Note that this patch does not check whether a given container is
actually a schema when recursing into it. In most cases this will
not matter, however it does mean that in some edge cases it will
attempt to resolve a `$ref` in a context where ref is actually not
part of the spec. Limiting resolution to schema-context containers
is outside the scope of this patch, but can be added later.
@erayd erayd deleted the bugfix-447-id-relative-ref branch October 5, 2017 04:38
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.

None yet

3 participants