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

v6.0.0 #390

Merged
merged 36 commits into from
Nov 10, 2017
Merged

v6.0.0 #390

merged 36 commits into from
Nov 10, 2017

Conversation

bighappyface
Copy link
Collaborator

This PR will be used to review the merge of the 6.0.0-dev branch into master.

See https://github.com/justinrainbow/json-schema/projects/2

erayd and others added 9 commits March 7, 2017 09:20
* Add URI translation for retrieval & add local copies of spec schema

* Use dist copies of schemas

No need to keep duplicate files around in package://tests/fixtures/ if
we're distributing them for users anyway.

* Move package:// translation after all other rules

Allows users to rewrite to package:// targets and still have the URI
work.
* centralize errors

* isolate 'more' info

* throw exception for missing error message

* swap args
This reverts commit 73ef463.

'email' is only a valid type attribute in draft-03 (later versions of
the spec explicitly limit the value of type to the core primitive
types), and this code doesn't validate email addresses anyway. IMO we
should be validating it properly or not at all, and noting this went
away after draft-03 my opinion is on the not-at-all side of the fence.

Note that 'email' is *never* defined as a spec type, in any version -
it just slips in under the radar of the draft-03 language which allows
users to put arbitrary things in the type field.
#378)

* Add provided schema under a dummy / internal URI (fixes #376)

In order to resolve internal $ref references within a user-provided
schema, SchemaStorage needs to know about the schema. As user-supplied
schemas do not have an associated URI, use a dummy / internal one instead.

* Remove dangling use

* Change URI to class constant on SchemaStorage
* add quiet option

* use verbose instead of quiet

* add quiet option

* always output dump-schema

* always output dump-schema-url

* fix typo and ws
* Add test coverage for coercion API

* Complete test coverage for SchemaStorage

* Add test coverage for ObjectIterator

* Add tests for ConstraintError

* Add exception test for JsonPointer

* MabeEnum\Enum appears to use singletons - add testing const

* Don't check this line for coverage

mbstring is on all test platforms, so this line will never be reached.

* Add test for TypeConstraint::validateTypeNameWording()

* Add test for exception on TypeConstraint::validateType()

* PHPunit doesn't like an explanation with its @codeCoverageIgnore...

* Add various tests for UriRetriever

* Add tests for FileGetContents

* Add tests for JsonSchema\Uri\Retrievers\Curl

* Add missing bad-syntax test file

* Restrict ignore to the exception line only

* Fix exception scope
@erayd
Copy link
Contributor

erayd commented Mar 17, 2017

Sounds good :-).

Do you have an intended timeline around 6.0.0, and would you like a change-freeze for it?

@erayd
Copy link
Contributor

erayd commented Mar 17, 2017

(I'm in no particular rush re 6.0.0 - whenever you are ready is fine, and quite happy to keep this open for a while until all the outstanding stuff has been worked through)

@bighappyface
Copy link
Collaborator Author

Are you able to edit the 6.0.0 project at all?

https://github.com/justinrainbow/json-schema/projects/2

@erayd
Copy link
Contributor

erayd commented Mar 17, 2017

@bigappyface Nope. I can see it, but cannot change anything.

@bighappyface
Copy link
Collaborator Author

:|

Not having admin access to this repo hurts. I would have made you guys collaborators weeks ago.

I (think) have basically everything in the PR queue for 6.0.0, open and closed PRs, listed out in the 6.0.0 project.

If we are good with what is there constituting 6.0.0 then I am happy to roll it out when everything in the Merged/Closed/Done column.

@erayd
Copy link
Contributor

erayd commented Mar 17, 2017

It's all good. Sounds like @justinrainbow has been AWOL for years, so there's really not much you can do in that regard without forking. It would be handy, but we can get by without it. We'll be up shit creek if you vanish too though.

What you have listed in the 6.0 0 project looks good, although I would really like it if 6.0.0 could also include some kind of document that makes it very clear what is public API, and what is internal to the project, so that we can avoid having to roll a new major version whenever something internal changes.

Can we also have a small change freeze after 6.0.0 looks done, but before it's merged to master, so that there's a bit of time to notice any uncaught bugs that might be problematic to users?

@bighappyface
Copy link
Collaborator Author

No problem on the code freeze.

Would you mind opening an issue around the documentation you mentioned? We can talk more about it there and then associate the issue with the 6.0.0 project to keep tabs on progress.

I would also like to get a CONTRIBUTORS document going too. We can put basic expectations and a code review checklist within to help guide folks as they come and go (although it is mostly just us, but people do come and go).

@erayd
Copy link
Contributor

erayd commented Mar 17, 2017

@bighappyface #392 :-).

erayd and others added 8 commits March 21, 2017 08:22
* Allow the schema to be an associative array

Implements #388.

* Use json_decode(json_encode()) for array -> object cast

* Skip exception check on PHP versions < 5.5.0

* Skip test on HHVM, as it's happy to encode resources
…365)

* Don't try to fetch files that don't exist

Throws an exception when the ref can't be resolved to a useful file URI,
rather than waiting for something further down the line to fail after
the fact.

* Refactor defaults code to use LooseTypeCheck where appropriate

* Test for not treating non-containers like arrays

* Update comments

* Rename variable for clarity

* Add CHECK_MODE_ONLY_REQUIRED_DEFAULTS

If CHECK_MODE_ONLY_REQUIRED_DEFAULTS is set, then only apply defaults
if they are marked as required.

* Workaround for $this scope issue on PHP-5.3

* Fix infinite recursion via $ref when applying defaults

* Add missing second test for array case

* Add test for setting a default value for null

* Also fix infinite recursion via $ref for array defaults

* Move nested closure into separate method

* $parentSchema will always be set when $name is, so don't check it

* Handle nulls properly - fixes issue #377
* Improve performance - don't loop over everything if already valid

* Don't coerce already-valid types (fixes #379)

* Add remaining coercion cases & rewrite tests

 * Add all remaining coercion cases from ajv matrix
 * Rewrite the coercion tests to tidy things up a bit

* Add CHECK_MODE_EARLY_COERCE

If set, falls back to the old behavior of coercing to the first
compatible type, regardless of whether another already-valid type might
be available.

* Add multiple-type test that requires coercion

* \JSON_PRETTY_PRINT doesn't exist in PHP-5.3, so work around this

* Various PR cleanup stuff

 * Fix whitespace
 * Turn $early into $extraFlags
 * Change "string" to "ABC" in string test
 * Update README.md description of CHECK_MODE_EARLY_COERCE

* Move loop after complex tests definition

* Move test #39 to grid #15
@bighappyface
Copy link
Collaborator Author

@erayd I suspected that the backports would cause conflicts. Would you mind opening a PR against 6.0.0-dev that has changes needed to get that branch out of conflict?

@erayd
Copy link
Contributor

erayd commented Mar 22, 2017

Not a problem, hang on.

erayd and others added 8 commits May 16, 2017 11:07
* Fix autoload to work properly with composer dependencies

* Use dirname()
…hema bug (#419)

* Split "uri" format into "uri" and "uri-reference"

* Correct format for id & $ref in draft-03/04 meta-schemas

See json-schema-org/JSON-Schema-Test-Suite#177 (comment)
* Remove dev-time dependency on phpdocumentor due to resolution headaches

* Switch distro for hhvm testing to trusty (precise now unsupported)
Note that this bugfix will cause empty query strings to be dropped (e.g.
http://example.com?#blue becomes http://example.com#blue). This is
because the '?' character is deliberately not captured as part of the
query string, and the testsuite expects to be able to pass an empty
query string and *not* have the '?' added for that case.
* Add tests for $ref enforcement

* Overriding schema properties from $ref is not allowed

From the spec [1]:
    An object schema with a "$ref" property MUST be interpreted as a
    "$ref" reference.  The value of the "$ref" property MUST be a URI
    Reference.  Resolved against the current URI base, it identifies the
    URI of a schema to use.  All other properties in a "$ref" object MUST
    be ignored.

[1] https://tools.ietf.org/html/draft-wright-json-schema-01#section-8

* Add test for infinite-loop circular reference

* Return dereferenced schema directly and check for infinite-loops

Schemas containing $ref MUST ignore all other properties, so just return
the reference target directly.

Because some circular references may result in an infinite loop, keep
track of the objects that have been dereferenced during the current call
to SchemaStorage and abort if the same object is encountered more than
once.

* Code style fix (remove blank line)
…le (#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
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.
@bighappyface
Copy link
Collaborator Author

@erayd sorry for the silence. I am completely out of touch on this.

Do we want to look at rolling 6.0.0?

@bighappyface
Copy link
Collaborator Author

^^ derp - reading #390 (comment) to get familiar again

@erayd
Copy link
Contributor

erayd commented Oct 3, 2017

@bighappyface I don't want to roll 6.0.0 yet; I don't think we're ready.There are still a number of outstanding items.

However... I do think that making 6.0.0-dev the default branch (or merging it into master) is a good idea, because that's the primary target for pull requests. The current master branch doesn't really serve any purpose, and isn't the head of any current development.

@erayd
Copy link
Contributor

erayd commented Oct 3, 2017

@bighappyface Things would go faster (and be more enjoyable too) if we had significant contribution from others - there currently seems to be a lack of interest to really get things going. Both you and @shmax have been really helpful with code reviews, but it feels like I've been carrying most of the actual implementation load over the last few months, and so if I don't have the time or inclination to do something, that thing doesn't usually happen until I get around to it.

This is not a complaint, and I don't mind - but I don't have unlimited time, and I don't get paid to work on this project, so things are proceeding slower than they otherwise might.

@bighappyface
Copy link
Collaborator Author

@erayd understood on both points. You have definitely stepped up, and I agree that more contributions would be helpful.

Unfortunately, I can not set the default branch without admin privileges.

I will set some time aside to get back up to speed and see what I can tackle for 6.0.0.

* Don't resolve a schema id against itself

* Add test for double-resolve bugfix
@dkarlovi
Copy link

dkarlovi commented Oct 4, 2017

Can't you guys just fork the project and deprecate the old one in composer.json, like https://github.com/ramsey/uuid did from rhumsaa/uuid?

@bighappyface
Copy link
Collaborator Author

@dkarlovi it has been discussed, but the replace property hasn't been brought forward before.

Thanks for the tip.

Some URI types do not pass validation against \FILTER_VAR_URL (e.g.
phar://), but are still valid and still have a scheme. This patch
catches those situations via a simple regex.
@erayd
Copy link
Contributor

erayd commented Oct 25, 2017

@bighappyface Can we merge this into master please, then delete this branch? We aren't actually using master for anything at the moment, and people keep opening pull requests against it because it's the default branch (which we can't change). All further 6.0.0 development would then take place on the master branch.

If you're OK with this, please do not use a merge style that squashes the changes into a single commit! For this one, we want to preserve the full commit history.

@erayd
Copy link
Contributor

erayd commented Nov 10, 2017

@bighappyface?

@mathroc mathroc mentioned this pull request Nov 10, 2017
@bighappyface bighappyface merged commit 237b077 into master Nov 10, 2017
@erayd
Copy link
Contributor

erayd commented Nov 12, 2017

@bighappyface Thanks! :-)

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.

8 participants