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

Fix latest version to properly support Product in plans #522

Merged
merged 2 commits into from
Feb 22, 2018

Conversation

remi-stripe
Copy link
Contributor

This ensures that you can create plans with the latest API version. We had 2 separate bugs:

  • re-using ProductParams meant that you could pass invalid parameters when creating a product inside a plan (such as Type which is unsupported).
  • not properly enforcing the latest API version which means all requests are currently failing.

This is a breaking change but it fixes what we broke in 29.0 so it's likely a better fit for 29.0.2 but unsure.

r? @brandur-stripe
cc @stripe/api-libraries

Before this, you could pass any parameter from ProductParams. This is not
correct as the nested creation of a product in a plan only accepts a
subset of parameters.
@remi-stripe
Copy link
Contributor Author

@brandur-stripe While on this PR, I think there's a bug in stripe-mock since it did not catch that product[type] on plan creation is forbidden.

@brandur-stripe
Copy link
Contributor

Oops, I kind of skipped over this one. Thanks for taking Remi!

This is a breaking change but it fixes what we broke in 29.0 so it's likely a better fit for 29.0.2 but unsure.

Yeah .. I'm going to send it out as a patch release and make a note about 29.0. I doubt too many people were using the plan features of 29.0 yet, so hopefully it's okay.

@brandur-stripe While on this PR, I think there's a bug in stripe-mock since it did not catch that product[type] on plan creation is forbidden.

I think the problem currently is that extra/unknown parameters are allowed. In this particular product subschema, type isn't even registered as a possibility:

product:
  anyOf:
  - description: The product whose pricing the created plan will represent.
      This can either be the ID of an existing product, or a dictionary
      containing fields used to create a [service product](/docs/api#product_object-type).
    properties:
      id:
        type: string
      metadata:
        type: object
      name:
        type: string
      statement_descriptor:
        type: string
    required:
    - name
    title: inline_product_params
    type: object
  - description: The ID of the product whose pricing the created plan
      will represent.
    type: string

@brandur-stripe brandur-stripe merged commit 88d3761 into master Feb 22, 2018
@brandur-stripe brandur-stripe deleted the remi-fix-plan-product branch February 22, 2018 00:45
@brandur-stripe
Copy link
Contributor

Released as 29.1.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants