commercetools/commercetools-sdk-java-v2

Address types do not seem consistent with API

ahmetoz opened this issue ยท 5 comments

The baseAddress as type does not seem consistent with the API. Please check if I'm wrong or not: https://docs.commercetools.com/api/releases/2021-01-29-custom-fields-for-addresses

I would expect to have 2 types as like documented on the API docs: Address and AddressDraft, also considering mapping between those each other should be easy as both almost same except custom field type.

For instance I can not map/build a valid address type.

CustomerDraftBuilder.of()
.addresses(BaseAddressBuilder.of().custom(?)); // not a method

We had to create this BaseAddress class in order to be able to differentiate between Address and AddressDraft in a backwards compatible way.

The fix here is to not use BaseAddressBuilder but the AddressDraftBuilder. Sorry for the confusion.

Oh yes, I got it now!
I think you could consider this issue as a feedback to add some javadoc for BaseAddress and it's purpose.

Yeah adding some javadoc to generated classes is somehow, let's say complicated ๐Ÿ˜ƒ

Hmm, I have a wrong mindset, I was not thinking about those are generated code, valid point ๐Ÿ˜„ ๐Ÿ‘๐Ÿฝ

It says so in the class and as well the folder structure ๐Ÿ˜‰

@Generated(value = "io.vrap.rmf.codegen.rendring.CoreCodeGenerator", comments = "https://github.com/vrapio/rmf-codegen")
public class BaseAddressBuilder implements Builder<BaseAddress> {