superfaceai / one-sdk-js

1️⃣ One Node.js SDK for all the APIs you want to integrate with
https://superface.ai
MIT License
46 stars 3 forks source link

[BUG] nullable enum input validation #311

Closed Jakub-Vacek closed 1 year ago

Jakub-Vacek commented 1 year ago

Provide a general summary of the issue in the Title above

Expected Behavior

Perform should pass

Current Behavior

Profile defines input field units enum {C, F, K} (optional enum, can be null) but when you specify units as null during perform call:

await profile
    .getUseCase('GetCurrentWeatherInCity')
    .perform({
      city: null,
      units: null
    }, {
      provider: 'wttr-in'
    });

SDK throws error:

InputValidationError {
  kind: 'InputValidationError',
  message: 'Input validation failed:\nPath: input.units\nError: Invalid enum value: null',
  errors: [ { kind: 'enumValue', context: [Object] } ],
  name: 'InputValidationError'
}

Possible Solution

Not obligatory, but suggest a fix/reason for the bug

Steps to Reproduce

Provide a link to a live example, or an unambiguous set of steps to reproduce this bug. Include code to reproduce, if relevant

  1. Use profile with nullable enum as input
  2. Run perform with enum value set to null

Your Environment

Include as many relevant details about the environment you experienced the bug in. Preferably include: