-
-
Notifications
You must be signed in to change notification settings - Fork 928
[core] Encode definition names to be compliant with JSON Pointer Specification #3669
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
Conversation
api-platform#3616) * Changed depth and maxDepth handling for selfreferencing subresourceOperations. Addresses: api-platform#2533. * Use single name for subpath * fix: address @rkopera comments Co-authored-by: Clemens Pflaum <clemens.pflaum@yahoo.de>
1dbe47d
to
bd2f071
Compare
behat tests failing |
@soyuka Done. |
looks good, @dunglas could you check ? |
commit b5fcf46 Author: soyuka <soyuka@users.noreply.github.com> Date: Wed Aug 12 16:02:51 2020 +0200 fix phpstan commit 0cbc7e2 Author: Arnaud J <jabin@cikaba.com> Date: Sat Aug 8 16:35:09 2020 +0200 :white_check_mark: Test API subresources with custom identifiers commit d741950 Author: mahmood bazdar <mahmood.bazdar@gmail.com> Date: Mon Apr 27 15:29:01 2020 +0430 Fixing error for none database identifiers Api ids
…esource has pagination disabled
* 2.5: fix: Order filter log when the property is invalid (api-platform#3673) Merge api-platform#3529 and api-platform#3671 (api-platform#3675) Check change tracking deferred for ODM (api-platform#3629) Changed depth and maxDepth handling for selfreferencing subresourceOp… (api-platform#3616) [GraphQL] No BC for types (api-platform#3654)
src/JsonSchema/SchemaFactory.php
Outdated
private function encodeDefinitionName(string $name): string | ||
{ | ||
$entities = ['%2F', '%7E']; | ||
$replacements = ['~1', '~0']; |
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.
Why is it necessary? IIRC only ~
and /
must be encoded, not there URL encoded versions. Or am I missing something?
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.
Please have a look at #1969 (comment)
The characters / and ~ in node names must be encoded as ~1 and ~0 when used in a $ref, and other special characters must be percent-encoded.
features/openapi/docs.feature
Outdated
@@ -95,7 +95,7 @@ Feature: Documentation support | |||
And the JSON node "paths./related_dummies/{id}/related_to_dummy_friends.get.parameters" should have 6 elements | |||
|
|||
# Subcollection - check schema | |||
And the JSON node "paths./related_dummies/{id}/related_to_dummy_friends.get.responses.200.content.application/ld+json.schema.properties.hydra:member.items.$ref" should be equal to "#/components/schemas/RelatedToDummyFriend:jsonld-fakemanytomany" | |||
And the JSON node "paths./related_dummies/{id}/related_to_dummy_friends.get.responses.200.content.application/ld+json.schema.properties.hydra:member.items.$ref" should be equal to "#/components/schemas/RelatedToDummyFriend%3Ajsonld-fakemanytomany" |
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.
If we introduce a BC break, shouldn't we also change to a URL-safe character as separator to make the names more human-readable?
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.
Currently there should be no BC break as only the refs are affected, not the definition names itself.
And you prefered urlencode in #1969 (comment)
But sure we can switch to safe chars, if you like. Then we would have a BC break ;-) Which do you prefer? I guess .
would be a good alternative to :
?
Actually, as pointed out by @hkosova (#1969 (comment)), the generated identifiers are still invalid according to the OpenAPI spec: |
@dunglas Good point, missed out OpenAPI 3.0 spec. Which character do you prefer from this regex? Would go with |
dot is ok for me |
…ints-in-swagger [Swagger] Fix that subresource endpoints do not override custom endpoints
api-platform#3676 - fixed subresource pagination support if primary resource has pagination disabled
|
* fix: fix tests * Remove phpspec/prophecy-phpunit * Fix tests * Fix PHPStan * wip * WIP * Add PhpUnitPolyfillTrait * Switch to simple-phpunit in Github Actions * Use PHPUnit 9 * Try to use the good version of PHPUnit * Use the master version of PHPUnit Bridge * Remove PHPUnit from deps * Use the files from Simple PHPUnit * wip * test * test * test * improve phpstan config * improve phpstan config * Fix Behat * Fix CI * Fix some deprecations * Fix build for Symfony 5.2 * Fix Mongo deprecations * Fix AppVeyor build
* Add changelog for 2.5.7 * Update CHANGELOG.md Co-authored-by: Alan Poulain <contact@alanpoulain.eu> Co-authored-by: Alan Poulain <contact@alanpoulain.eu>
feat: bump JS deps
* 2.5: feat: bump JS deps Add changelog for 2.5.7 (api-platform#3691) fix: fix tests (api-platform#3688) Fix missing use statement (api-platform#3670) [MongoDB] Fix Behat tests (api-platform#3687) Fix missing Doctrine\Common\Persistence\ManagerRegistry class (api-platform#3684) [Swagger] Fix that subresource endpoints do not override custom endpoints api-platform#3676 - fixed subresource pagination support if primary resource has pagination disabled
* Use symfony/serializer >=4.4.9-5.0.9 to fix issues symfony/symfony#34455 symfony/symfony#36601 * Lowest + legacy test suite missing git * fix Symfony 5 router generate with reference type
# Conflicts: # CHANGELOG.md
…finition names to be compliant with OpenAPI 3.0
This PR currently only urlencodes the colon:
separator in schema names as this currently seems the only illegal char besides the alloweda-zA-Z0-9 _ . -
in OpenAPI 3.0.This PR urlencodes the whole name and additionally replacing
/
and~
according to JSON Pointer Specification.