I attempted to generate a pkl schema from a JSON schema as explained here. Strangely, the output contained duplicated class definitions, which caused the pkl eval process to fail with
–– Pkl Error ––
Duplicate definition of member `Target`.
544 | class Target {
^^^^^^^^^^^^
I believe the issue is L225 in the snippet below. existingTypeNames has type Set<Type>, and the contains function compares the set entries to a string, which always returns false.
I attempted to generate a pkl schema from a JSON schema as explained here. Strangely, the output contained duplicated class definitions, which caused the pkl eval process to fail with
Reproduction
Generate a pkl schema from the JSON schema:
then run
I believe the issue is L225 in the snippet below.
existingTypeNames
has typeSet<Type>
, and the contains function compares the set entries to a string, which always returns false.https://github.com/apple/pkl-pantry/blob/4f8f939c35ff1fdc04b0897db4b53c05ff234186/packages/org.json_schema.contrib/internal/ModuleGenerator.pkl#L224-L245
Solution
Update L225 as follows:
I tested this successfully with the reproduction case.