-
-
Notifications
You must be signed in to change notification settings - Fork 891
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: handle uriTemplate on property for JSON:API format
- Loading branch information
1 parent
86ee2d0
commit e3bf432
Showing
3 changed files
with
77 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
@php8 | ||
@v3 | ||
Feature: Exposing a property being a collection of resources | ||
can return an IRI instead of an array | ||
when the uriTemplate is set on the ApiProperty attribute | ||
|
||
Background: | ||
Given I add "Accept" header equal to "application/vnd.api+json" | ||
And I add "Content-Type" header equal to "application/vnd.api+json" | ||
|
||
Scenario: Retrieve Resource with uriTemplate collection Property | ||
Given there are propertyCollectionIriOnly with relations | ||
And I send a "GET" request to "/property_collection_iri_onlies/1" | ||
Then the response status code should be 200 | ||
And the response should be in JSON | ||
And the JSON should be valid according to the JSON HAL schema | ||
And the header "Content-Type" should be equal to "application/vnd.api+json; charset=utf-8" | ||
And the JSON should be equal to: | ||
""" | ||
{ | ||
"links": { | ||
"propertyCollectionIriOnlyRelation": "/property-collection-relations", | ||
"iterableIri": "/parent/1/another-collection-operations" | ||
}, | ||
"data": { | ||
"id": "/property_collection_iri_onlies/1", | ||
"type": "PropertyCollectionIriOnly", | ||
"relationships": { | ||
"propertyCollectionIriOnlyRelation": { | ||
"data": [ | ||
{ | ||
"type": "PropertyCollectionIriOnlyRelation", | ||
"id": "/property_collection_iri_only_relations/1" | ||
} | ||
] | ||
}, | ||
"iterableIri": { | ||
"data": [ | ||
{ | ||
"type": "PropertyCollectionIriOnlyRelation", | ||
"id": "/property_collection_iri_only_relations/9999" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters