Repository navigation
Fix V3 enum-typed DTO properties decoded as nested objects - #76
Merged
jstapelkamp merged 1 commit intoJun 22, 2026
Merged
Conversation
…objects Enum schemas (e.g. DatabankViewOption) are referenced by $ref but carry no type key, so the generator treated them as object DTOs and emitted empty classes plus a Foo::make(string) call. getProductMedia then crashed with a TypeError when the API returned the enum value as a string. Enum references are now generated as their scalar type. Fixes LKCAPIBRIDGENL-1V
Contributor
Author
|
Tested against real data and is now working. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enum schemas (e.g.
DatabankViewOption,ContactTypeEnum,WebsiteProductListType) are referenced via$refbut carry notypekey in the V3 OpenAPI spec. The generator treated every$refproperty as a nested object DTO, so it emitted empty enum classes plus aFoo::make($data["Type"])call.At runtime
getProductMediacrashed with:because the API returns the enum value as a plain string (e.g.
"Photo").Fix
ComponentClassGeneratornow detects when a referenced schema is an enum and generates the property as its scalar (string) type instead of a nested DTO. Regenerated the affected V3 classes (ProductResource,ContactCharacteristic,WebshopVisitorBehaviour) and removed the three orphaned empty enum DTO classes.Test
Added
ProductMediaTestreproducing the production path (getProductMedia->ProductMediaFileDto->ProductResource) with a stringType, which threw before the fix and now decodes correctly.Fixes LKCAPIBRIDGENL-1V