feat: derive JaneObjectNormalizer::getSupportedTypes from $this->norm…
…alizers
Closes #837
@Korbeil this one is puzzling. :thinking:
I was checking if I could put your PR in the release but it will need more work, in src/Component/JsonSchema/Tests/generated/Normalizer/JsonSchemaNormalizer.php you can see the base JsonSchema normalizer.
The getSupportedTypes method is containing following code:
public function getSupportedTypes(?string $format = null): array
{
return array_combine(array_keys($this->normalizers), array_fill(0, count($this->normalizers), false));
}
But there is no $normalizers property in this class.
@Korbeil it seems this class is somehow "special", like it's being generated by this code, but also by something else. :thinking:
What if we streamline it to look like all the other classes and add the normalizers property to it, even if it has only one entry?
Yes it is ! the one in src/Component/JsonSchema/JsonSchema/Normalizer/JsonSchemaNormalizer.php is a generated version of the JsonSchema specification. And we do verify if our generation process is fine by generating it in tests: src/Component/JsonSchema/Tests/generated/Normalizer/JsonSchemaNormalizer.php.
Also, it's not only in this normalizer we don't have the $normalizers variable, usually we only have it in JaneObjectNormalizer classes (and there is only one per generated schema).
That's what I meant: if we check the other normalizers, they have the single FQCN embedded in the method. What if we moved that one FQCN into the normalizers prop (which we add) and by that way we streamline all the normalizers? This way they're all basically the same structure.
Hey, this PR seems stalled since last April, I'll close it for now, please re-open it if you have any time working on it :pray: