Skip to content

Commit

Permalink
fix: enum property overriding when using $ref glideapps#2319 (glideap…
Browse files Browse the repository at this point in the history
…ps#2326)

Co-authored-by: David Siegel <[email protected]>
  • Loading branch information
DanielBretzigheimer and dvdsgl authored Feb 14, 2024
1 parent ac1429f commit bb5f033
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/quicktype-core/src/attributes/StringTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,14 @@ export class StringTypes {
} else if (other.cases !== undefined) {
const thisCases = cases;
const otherCases = other.cases;
cases = mapMap(setIntersect(thisCases.keys(), new Set(otherCases.keys())).entries(), k =>
Math.min(defined(thisCases.get(k)), defined(otherCases.get(k)))
);

const intersects = setIntersect(thisCases.keys(), new Set(otherCases.keys()));
const entries = intersects.size > 0 ? intersects.entries() : new Set(thisCases.keys()).entries();
cases = mapMap(entries, k => {
const thisValue = defined(thisCases.get(k));
const otherValue = otherCases.get(k) ?? Math.min();
return Math.min(thisValue, otherValue);
});
}

transformations = setIntersect(transformations, other.transformations);
Expand Down

0 comments on commit bb5f033

Please sign in to comment.