[Json-Schema] Nested resources lost externalDoc and description data
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 68/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- php
- Domain
- api, backend-api-design
Research direction
Start by reading the change in src/Hydra/JsonSchema/SchemaFactory.ph introduced by #8652, which the report identifies as the source of the regression. Reproduce the example with nested SchemaThing resources and compare the generated JSON OpenAPI output before and after the change. Done means the nested resource retains its documentation and externalDocs data.
Written by the indexing model from the issue text.
Description
API Platform version(s) affected: 5.0.4
Description
We have some shared api schemas that are linked to schema.org specs, and the generated jsonopenapi spec file contained this information. But after updating to the latest version, we lost these details.
Both the documentation and externalDocs fields are now empty.
screenshots
Before:After:
How to reproduce
#[Get(provider: EntityStateProvider::class, processor: EntityStateProcessor::class)]
class Entity
{
public function __construct(
#[ApiProperty(identifier: true)]
public int $id,
#[ApiProperty(readableLink: true)]
public SchemaThing $thing
)
{
}
}
#[ApiResource(description: "A schema type", types: ['https://schema.org/Thing'], operations: [])]
class SchemaThing
{
#[ApiProperty(description: "The name of the item.", iris: ['https://schema.org/name'])]
public string $name;
#[ApiProperty(description: "An alias for the item.", iris: ['https://schema.org/alternateName'])]
public string $alternateName;
}
Additional Context
If I revert the change in src/Hydra/JsonSchema/SchemaFactory.ph by #8652 the issue is fixed
- Dominant language
- PHP
- Stars
- 2.6k
- Forks
- 989
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 102
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from api-platform/core
-
JSON:API: resource schemas (`*.jsonapi`) have `properties` but no `type: object`Possibly taken @ousamabenyounes claimed this 1 day ago. Open
Difficulty 2/5 Under an hour Newbie friendliness 80/100
api-platform/core#8701 ·
Maintainers usually reply within 1 day
-
JSON:API: `JsonApiCollectionBaseSchemaNoPagination` declares `data` as `type: array` without `items`Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
api-platform/core#8699 ·
Maintainers usually reply within 1 day
-
api:openapi:export --spec-version=3.0.0 outputs `webhooks`, which is invalid in OpenAPI 3.0Possibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
api-platform/core#8690 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
api-platform/core#8680 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
api-platform/core#8725 ·
Maintainers usually reply within 1 day
All issues in api-platform/core
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
grokability/snipe-it#19857 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
Maintainers usually reply within 1 day
-
Authentication / Authorization Feature: Volunteer
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
WordPress/mcp-adapter#399 ·
Maintainers usually reply within 1 day