Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed AttributeDefinitionDraft #30

Closed
wants to merge 1 commit into from

Conversation

tleguijt
Copy link
Contributor

@tleguijt tleguijt commented Oct 8, 2018

Signature is the same as AttributeDefinition.
The only difference lies in the name being required, but this isn't enforced in the SDK itself.
To simplify the interface we can just utilize the AttributeDefinition when creating a new attribute
and perform validations in the create/update methods themselve (or leave it as it is right now
and let the commercetool API return an error)

Signature is the same as AttributeDefinition.
The only difference lies in the name being required, but this isn't enforced in the SDK itself.
To simplify the interface we can just utilize the AttributeDefinition when creating a new attribute
and perform validations in the create/update methods themselve (or leave it as it is right now
and let the commercetool API return an error)
@jberghoef
Copy link
Contributor

I'm a little bit worried this change will result in reduced consistency between the various sub-packages. @MichielBijland do you have an opinion about this?

@tleguijt
Copy link
Contributor Author

tleguijt commented Oct 8, 2018

Looking at the commercetools API the implementation seems inconsistent.
The Product Type is quite similar to the Type in many aspects.
Instead of fieldDefinitions you define attributeDefinitions.

For a TypeDraft, these are defined as regular FieldDefinition types (https://docs.commercetools.com/http-api-projects-types.html#typedraft).
However, for the ProductTypeDraft, it needs a AttributeDefinitionDraft, which in essence is the same as a AttributeDefinition.

I think that by ignoring the need for a Draft object on the SDK side we can offer a more consistent interface to work with, and reduce the amount of code need to be written for creating/reading the attribute definitions (so basically removing the need to implement the same code for both types (Draft and non-Draft) of such an attribute definition.

@codecov
Copy link

codecov bot commented Oct 8, 2018

Codecov Report

Merging #30 into master will increase coverage by 0.29%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #30      +/-   ##
==========================================
+ Coverage   85.07%   85.36%   +0.29%     
==========================================
  Files          39       39              
  Lines        1735     1729       -6     
==========================================
  Hits         1476     1476              
+ Misses        188      182       -6     
  Partials       71       71
Impacted Files Coverage Δ
service/producttypes/types.go 98.33% <ø> (+3.17%) ⬆️
service/producttypes/actions.go 100% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1233fab...2301701. Read the comment docs.

@tleguijt tleguijt closed this Oct 8, 2018
@tleguijt tleguijt deleted the feature/attribute_draft_removal branch October 8, 2018 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants