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

Fix issues with extending {XML,Yaml} -> {XML,Yaml} resources #5956

Open
wants to merge 2 commits into
base: 3.2
Choose a base branch
from

Conversation

senghe
Copy link

@senghe senghe commented Nov 9, 2023

Q A
Branch? 3.2
Tickets
License MIT
Doc PR

Hi all! :) I was testing a feature of extending resources by multiple XML/Yaml resource files for the same resource. For XMLs it works from scratch, but there is two issues:

  • First, when trying to extend Yaml configuration by another Yaml configuration
  • Second, when trying to extend Yaml configuration by XML, and when trying to extend XML by Yaml.

It looks for me as a bug, because as you can see, there is too little changes from me to solve it.

Please let me know, what is your opinion regarding to this topic 🖖

@senghe senghe changed the title Fix issues with extending Yaml -> Yaml resources, additionally fix extending {XML,Yaml} -> {XML,Yaml} resources Fix issues with extending {XML,Yaml} -> {XML,Yaml} resources Nov 9, 2023
@senghe senghe force-pushed the hotfix/fix-extending-resources-3.2 branch 2 times, most recently from cbae89d to 9773872 Compare November 9, 2023 08:23
@senghe senghe force-pushed the hotfix/fix-extending-resources-3.2 branch from 9773872 to aea2f42 Compare November 9, 2023 08:25
@senghe
Copy link
Author

senghe commented Nov 9, 2023

I see one build run has been cancelled - the red one. Could you rerun it? 🙏

@@ -75,14 +75,15 @@ private function buildResources(array $resourcesYaml, string $path): void
$resourceYaml = [$resourceYaml];
}

$resourcesCount = isset($this->resources[$resourceName]) ? \count($this->resources[$resourceName]) : 0;
foreach ($resourceYaml as $key => $resourceYamlDatum) {
Copy link
Member

Choose a reason for hiding this comment

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

is key always an int @vincentchalamon ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmmm not sure that it's always an int, cf. https://github.com/api-platform/core/blob/main/src/Metadata/Tests/Extractor/yaml/valid.yaml

To be sure, it would be better to rely on an int variable declared out of this foreach and incremented accordingly.

@soyuka
Copy link
Member

soyuka commented Nov 24, 2023

this looks nice, can you target 3.1? We should add a test somehow

Copy link

stale bot commented Jan 24, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jan 24, 2024
@senghe
Copy link
Author

senghe commented Jan 24, 2024

Hi, to be honest I'm not so familiar with API Platform dev structure, so I think I'm not able to add tests here. But in a free time I'll check whether the index is always integer - as it was discussed above and refactor this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants