Skip to content

Conversation

@VincentLanglet
Copy link
Contributor

@VincentLanglet VincentLanglet commented Nov 10, 2025

Q A
Branch? 4.2 for bugfix (or main for new interface ?)
Tickets Closes #..., closes #...
License MIT
Doc PR api-platform/docs#...

Related to https://github.com/api-platform/core/pull/7481/files#r2480673359

Currently the SchemaFactory has cache, and the generated key is done with

DefinitionNameFactoryInterface::create(string $className, string $format = 'json', ?string $inputOrOutputClass = null, ?Operation $operation = null, array $serializerContext = []): string;

but this signature does not take account the $type which is input or output.

BUT the return value of SchemaFactory might be different for input and output.

I see two solution for this:

  • manually suffixing input/output at every places the cache key is used
  • or introducing a new interface and deprecating implementing only the old one.

In Next major this could be eventually renamed...

I made a POC with the new interface.
Do you agree with the issue @soyuka and are you ok with this solution or do you prefer another ?

@VincentLanglet VincentLanglet force-pushed the TypeAwareDefinitionNameFactoryInterface branch from 39e21ea to 63345d9 Compare November 10, 2025 15:18
@VincentLanglet
Copy link
Contributor Author

I didn't expect a such impact... that's annoying...

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.

1 participant