Closed Leptopoda closed 5 months ago
Apparently float and double are the same thing in PHP and internally they are always stored with double precision (https://www.php.net/manual/en/language.types.float.php).
Opened https://github.com/nextcloud/openapi-extractor/issues/123 to track that problem.
I think I'd rather avoid doing this because it can get complex when you have stuff like min/max values and it would only be allowed to merge if both types have the same constraints or no constraints. It's a lot of work to do it right without that many benefits IMO.
Currently the generator produces a lot of
anyOf<integer|double>
that can also be expressed as a plain number.which could be the expressed as:
This both increases the readability of the generated specs and improves compatibility with code generators (out of experience generators often generate broken code for oneOf/anyOf especially when nested).
Potential downsides: AFAICT the specs always make use of
float
andint64
while a plain number would also allow double precision fractional numbers. I don't know how php handles that.