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

Update Validator Input Options Behavior #1579

Merged
merged 3 commits into from
Feb 18, 2022
Merged

Conversation

austinborn
Copy link
Contributor

@austinborn austinborn commented Feb 17, 2022

Closes #1531

Description

In line 22 of normalize/index.ts, the Validator runs without throwing errors and below that undefined values are removed. If an input is not in the options set then an error would be thrown, but due to shouldThrowError: false it just returns undefined and is removed. Then in a second pass to Validator the value is set to the default.

Changes

  • Preserve input values when shouldThrowError = false
  • Compare input options as lowercase values

Steps to Test

  1. Start an adapter with some input that has options and a default
  2. If you send a request with some input not in the options list, the response should now return an error instead of using the default value
  3. If you send a request with some input in the options list with different capitalization, the response should still succeed

Quality Assurance

  • Ran yarn changeset if adapter source code was changed
  • If a new adapter was made, or an existing one was modified so that its environment variables have changed, update the relevant <ADAPTER_PACKAGE>/schemas/env.json and <ADAPTER_PACKAGE>/README.md
  • If a new adapter was made, or an existing one was modified so that its environment variables have changed, update the relevant infra-k8s configuration file.
  • The branch naming follows git flow (feature/x, chore/x, release/x, hotfix/x, fix/x) or is created from Clubhouse/Shortcut
  • This is related to a maximum of one Clubhouse/Shortcut story or GitHub issue
  • Types are safe (avoid TypeScript/TSLint features like any and disable, instead use more specific types)

@changeset-bot
Copy link

changeset-bot bot commented Feb 17, 2022

🦋 Changeset detected

Latest commit: a5257b6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 158 packages
Name Type
@chainlink/ea-bootstrap Patch
@chainlink/anchor-adapter Patch
@chainlink/apy-finance-adapter Patch
@chainlink/augur-adapter Patch
@chainlink/bitcoin-json-rpc-adapter Patch
@chainlink/bob-adapter Patch
@chainlink/bsol-price-adapter Patch
@chainlink/circuit-breaker-adapter Patch
@chainlink/crypto-volatility-index-adapter Patch
@chainlink/defi-dozen-adapter Patch
@chainlink/defi-pulse-adapter Patch
@chainlink/dns-record-check-adapter Patch
@chainlink/dxdao-adapter Patch
@chainlink/dydx-rewards-adapter Patch
@chainlink/google-weather-adapter Patch
@chainlink/historical-average-adapter Patch
@chainlink/linear-finance-adapter Patch
@chainlink/market-closure-adapter Patch
@chainlink/medianizer-adapter Patch
@chainlink/outlier-detection-adapter Patch
@chainlink/por-indexer-adapter Patch
@chainlink/proof-of-reserves-adapter Patch
@chainlink/reference-transform-adapter Patch
@chainlink/set-token-index-adapter Patch
@chainlink/synth-index-adapter Patch
@chainlink/the-graph-adapter Patch
@chainlink/token-allocation-adapter Patch
@chainlink/vesper-adapter Patch
@chainlink/xsushi-price-adapter Patch
@chainlink/ea-factories Patch
@chainlink/ea-reference-data-reader Patch
@chainlink/example-composite-adapter Patch
@chainlink/example-source-adapter Patch
@chainlink/1forge-adapter Patch
@chainlink/accuweather-adapter Patch
@chainlink/ada-balance-adapter Patch
@chainlink/alphachain-adapter Patch
@chainlink/alphavantage-adapter Patch
@chainlink/amberdata-adapter Patch
@chainlink/anyblock-adapter Patch
@chainlink/ap-election-adapter Patch
@chainlink/bea-adapter Patch
@chainlink/binance-dex-adapter Patch
@chainlink/binance-adapter Patch
@chainlink/bitex-adapter Patch
@chainlink/bitso-adapter Patch
@chainlink/blockchain.com-adapter Patch
@chainlink/blockchair-adapter Patch
@chainlink/blockcypher-adapter Patch
@chainlink/blockstream-adapter Patch
@chainlink/bravenewcoin-adapter Patch
@chainlink/btc.com-adapter Patch
@chainlink/cache.gold-adapter Patch
@chainlink/cfbenchmarks-adapter Patch
@chainlink/chain-reserve-wallet-adapter Patch
@chainlink/coinapi-adapter Patch
@chainlink/coinbase-adapter Patch
@chainlink/coincodex-adapter Patch
@chainlink/coingecko-adapter Patch
@chainlink/coinlore-adapter Patch
@chainlink/coinmarketcap-adapter Patch
@chainlink/coinmetrics-adapter Patch
@chainlink/coinpaprika-adapter Patch
@chainlink/coinranking-adapter Patch
@chainlink/covid-tracker-adapter Patch
@chainlink/cryptoapis-v2-adapter Patch
@chainlink/cryptoapis-adapter Patch
@chainlink/cryptocompare-adapter Patch
@chainlink/cryptoid-adapter Patch
@chainlink/cryptomkt-adapter Patch
@chainlink/currencylayer-adapter Patch
@chainlink/curve-adapter Patch
@chainlink/deribit-adapter Patch
@chainlink/dns-query-adapter Patch
@chainlink/dwolla-adapter Patch
@chainlink/dxfeed-secondary-adapter Patch
@chainlink/dxfeed-adapter Patch
@chainlink/enzyme-adapter Patch
@chainlink/eodhistoricaldata-adapter Patch
@chainlink/eth-balance-adapter Patch
@chainlink/etherchain-adapter Patch
@chainlink/etherscan-adapter Patch
@chainlink/ethgasstation-adapter Patch
@chainlink/ethgaswatch-adapter Patch
@chainlink/expert-car-broker-adapter Patch
@chainlink/fcsapi-adapter Patch
@chainlink/finage-adapter Patch
@chainlink/finnhub-adapter Patch
@chainlink/fixer-adapter Patch
@chainlink/flightaware-adapter Patch
@chainlink/fmpcloud-adapter Patch
@chainlink/gemini-adapter Patch
@chainlink/genesis-volatility-adapter Patch
@chainlink/geodb-adapter Patch
@chainlink/google-bigquery-adapter Patch
@chainlink/gramchain-adapter Patch
@chainlink/graphql-adapter Patch
@chainlink/iex-cloud-adapter Patch
@chainlink/intrinio-adapter Patch
@chainlink/ipfs-adapter Patch
@chainlink/jpegd-adapter Patch
@chainlink/json-rpc-adapter Patch
@chainlink/kaiko-adapter Patch
@chainlink/layer2-sequencer-health-adapter Patch
@chainlink/lcx-adapter Patch
@chainlink/linkpool-adapter Patch
@chainlink/lition-adapter Patch
@chainlink/lotus-adapter Patch
@chainlink/marketstack-adapter Patch
@chainlink/messari-adapter Patch
@chainlink/metalsapi-adapter Patch
@chainlink/mock-ea-adapter Patch
@chainlink/mycryptoapi-adapter Patch
@chainlink/ncfx-adapter Patch
@chainlink/nikkei-adapter Patch
@chainlink/nomics-adapter Patch
@chainlink/oilpriceapi-adapter Patch
@chainlink/onchain-gas-adapter Patch
@chainlink/openexchangerates-adapter Patch
@chainlink/orchid-bandwidth-adapter Patch
@chainlink/paxos-adapter Patch
@chainlink/paypal-adapter Patch
@chainlink/poa-adapter Patch
@chainlink/polygon-adapter Patch
@chainlink/reduce-adapter Patch
@chainlink/renvm-address-set-adapter Patch
@chainlink/satoshitango-adapter Patch
@chainlink/snowflake-adapter Patch
@chainlink/sochain-adapter Patch
@chainlink/solana-view-function-adapter Patch
@chainlink/spectral-macro-score-adapter Patch
@chainlink/sportsdataio-adapter Patch
@chainlink/stasis-adapter Patch
@chainlink/synthetix-debt-pool-adapter Patch
@chainlink/taapi-adapter Patch
@chainlink/terra-view-function-adapter Patch
@chainlink/therundown-adapter Patch
@chainlink/tiingo-adapter Patch
@chainlink/tradermade-adapter Patch
@chainlink/tradingeconomics-adapter Patch
@chainlink/trueusd-adapter Patch
@chainlink/twelvedata-adapter Patch
@chainlink/unibit-adapter Patch
@chainlink/uniswap-v2-adapter Patch
@chainlink/uniswap-v3-adapter Patch
@chainlink/upvest-adapter Patch
@chainlink/uscpi-one-adapter Patch
@chainlink/view-function-adapter Patch
@chainlink/wbtc-address-set-adapter Patch
@chainlink/wootrade-adapter Patch
@chainlink/wrapped-adapter Patch
@chainlink/xbto-adapter Patch
@chainlink/agoric-adapter Patch
@chainlink/conflux-adapter Patch
@chainlink/dydx-stark-adapter Patch
@chainlink/ethwrite-adapter Patch
@chainlink/harmony-adapter Patch
@chainlink/ea Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@austinborn austinborn temporarily deployed to QA February 17, 2022 23:41 Inactive
@austinborn austinborn requested a review from a team February 17, 2022 23:41
@austinborn austinborn changed the title Add uppercase as options for xbto Update Validator Input Options Behavior Feb 17, 2022
Copy link
Collaborator

@justinkaseman justinkaseman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for that! LGTM

@austinborn austinborn merged commit ab17812 into develop Feb 18, 2022
@austinborn austinborn deleted the fix/validator-options branch February 18, 2022 01:35
@austinborn austinborn temporarily deployed to QA February 18, 2022 01:35 Inactive
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.

InputParameters' "default" value used when an invalid "options" value is provided
2 participants