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

Failed validation: #/definitions/QuoteResponseArray #636

Closed
pazer001 opened this issue Apr 22, 2023 · 8 comments
Closed

Failed validation: #/definitions/QuoteResponseArray #636

pazer001 opened this issue Apr 22, 2023 · 8 comments
Labels
invalid This doesn't seem right released validation Issues related to validation

Comments

@pazer001
Copy link

Validation Error

Minimal Reproduction

Symbol(s) that it happened for

  • CRD.B
  • MOG.A
  • HEI.A

Error Message

The following result did not validate with schema: #/definitions/QuoteResponseArray
[
  {
    instancePath: '/0',
    schemaPath: '#/definitions/QuoteEquity/required',
    keyword: 'required',
    params: { missingProperty: 'exchange' },
    message: "must have required property 'exchange'",
    data: {
      language: 'en-US',
      region: 'US',
      quoteType: 'EQUITY',
      typeDisp: 'Equity',
      triggerable: false,
      customPriceAlertConfidence: 'LOW',
      esgPopulated: false,
      priceHint: 2,
      earningsTimestamp: 2018-08-06T20:15:00.000Z,
      earningsTimestampStart: 2018-08-06T20:15:00.000Z,
      earningsTimestampEnd: 2018-08-06T20:15:00.000Z,
      tradeable: false,
      cryptoTradeable: false,
      symbol: 'CRD.B'
    }
  },
  {
    instancePath: '/0',
    schemaPath: '#/definitions/QuoteEquity/required',
    keyword: 'required',
    params: { missingProperty: 'exchangeDataDelayedBy' },
    message: "must have required property 'exchangeDataDelayedBy'",
    data: {
      language: 'en-US',
      region: 'US',
      quoteType: 'EQUITY',
      typeDisp: 'Equity',
      triggerable: false,
      customPriceAlertConfidence: 'LOW',
      esgPopulated: false,
      priceHint: 2,
      earningsTimestamp: 2018-08-06T20:15:00.000Z,
      earningsTimestampStart: 2018-08-06T20:15:00.000Z,
      earningsTimestampEnd: 2018-08-06T20:15:00.000Z,
      tradeable: false,
      cryptoTradeable: false,
      symbol: 'CRD.B'
    }
  },
  {
    instancePath: '/0',
    schemaPath: '#/definitions/QuoteEquity/required',
    keyword: 'required',
    params: { missingProperty: 'exchangeTimezoneName' },
    message: "must have required property 'exchangeTimezoneName'",
    data: {
      language: 'en-US',
      region: 'US',
      quoteType: 'EQUITY',
      typeDisp: 'Equity',
      triggerable: false,
      customPriceAlertConfidence: 'LOW',
      esgPopulated: false,
      priceHint: 2,
      earningsTimestamp: 2018-08-06T20:15:00.000Z,
      earningsTimestampStart: 2018-08-06T20:15:00.000Z,
      earningsTimestampEnd: 2018-08-06T20:15:00.000Z,
      tradeable: false,
      cryptoTradeable: false,
      symbol: 'CRD.B'
    }
  },
  {
    instancePath: '/0',
    schemaPath: '#/definitions/QuoteEquity/required',
    keyword: 'required',
    params: { missingProperty: 'exchangeTimezoneShortName' },
    message: "must have required property 'exchangeTimezoneShortName'",
    data: {
      language: 'en-US',
      region: 'US',
      quoteType: 'EQUITY',
      typeDisp: 'Equity',
      triggerable: false,
      customPriceAlertConfidence: 'LOW',
      esgPopulated: false,
      priceHint: 2,
      earningsTimestamp: 2018-08-06T20:15:00.000Z,
      earningsTimestampStart: 2018-08-06T20:15:00.000Z,
      earningsTimestampEnd: 2018-08-06T20:15:00.000Z,
      tradeable: false,
      cryptoTradeable: false,
      symbol: 'CRD.B'
    }
  },
  {
    instancePath: '/0',
    schemaPath: '#/definitions/QuoteEquity/required',
    keyword: 'required',
    params: { missingProperty: 'fullExchangeName' },
    message: "must have required property 'fullExchangeName'",
    data: {
      language: 'en-US',
      region: 'US',
      quoteType: 'EQUITY',
      typeDisp: 'Equity',
      triggerable: false,
      customPriceAlertConfidence: 'LOW',
      esgPopulated: false,
      priceHint: 2,
      earningsTimestamp: 2018-08-06T20:15:00.000Z,
      earningsTimestampStart: 2018-08-06T20:15:00.000Z,
      earningsTimestampEnd: 2018-08-06T20:15:00.000Z,
      tradeable: false,
      cryptoTradeable: false,
      symbol: 'CRD.B'
    }
  },
  {
    instancePath: '/0',
    schemaPath: '#/definitions/QuoteEquity/required',
    keyword: 'required',
    params: { missingProperty: 'gmtOffSetMilliseconds' },
    message: "must have required property 'gmtOffSetMilliseconds'",
    data: {
      language: 'en-US',
      region: 'US',
      quoteType: 'EQUITY',
      typeDisp: 'Equity',
      triggerable: false,
      customPriceAlertConfidence: 'LOW',
      esgPopulated: false,
      priceHint: 2,
      earningsTimestamp: 2018-08-06T20:15:00.000Z,
      earningsTimestampStart: 2018-08-06T20:15:00.000Z,
      earningsTimestampEnd: 2018-08-06T20:15:00.000Z,
      tradeable: false,
      cryptoTradeable: false,
      symbol: 'CRD.B'
    }
  },
  {
    instancePath: '/0',
    schemaPath: '#/definitions/QuoteEquity/required',
    keyword: 'required',
    params: { missingProperty: 'market' },
    message: "must have required property 'market'",
    data: {
      language: 'en-US',
      region: 'US',
      quoteType: 'EQUITY',
      typeDisp: 'Equity',
      triggerable: false,
      customPriceAlertConfidence: 'LOW',
      esgPopulated: false,
      priceHint: 2,
      earningsTimestamp: 2018-08-06T20:15:00.000Z,
      earningsTimestampStart: 2018-08-06T20:15:00.000Z,
      earningsTimestampEnd: 2018-08-06T20:15:00.000Z,
      tradeable: false,
      cryptoTradeable: false,
      symbol: 'CRD.B'
    }
  },
  {
    instancePath: '/0',
    schemaPath: '#/definitions/QuoteEquity/required',
    keyword: 'required',
    params: { missingProperty: 'marketState' },
    message: "must have required property 'marketState'",
    data: {
      language: 'en-US',
      region: 'US',
      quoteType: 'EQUITY',
      typeDisp: 'Equity',
      triggerable: false,
      customPriceAlertConfidence: 'LOW',
      esgPopulated: false,
      priceHint: 2,
      earningsTimestamp: 2018-08-06T20:15:00.000Z,
      earningsTimestampStart: 2018-08-06T20:15:00.000Z,
      earningsTimestampEnd: 2018-08-06T20:15:00.000Z,
      tradeable: false,
      cryptoTradeable: false,
      symbol: 'CRD.B'
    }
  },
  {
    instancePath: '/0',
    schemaPath: '#/definitions/QuoteEquity/required',
    keyword: 'required',
    params: { missingProperty: 'sourceInterval' },
    message: "must have required property 'sourceInterval'",
    data: {
      language: 'en-US',
      region: 'US',
      quoteType: 'EQUITY',
      typeDisp: 'Equity',
      triggerable: false,
      customPriceAlertConfidence: 'LOW',
      esgPopulated: false,
      priceHint: 2,
      earningsTimestamp: 2018-08-06T20:15:00.000Z,
      earningsTimestampStart: 2018-08-06T20:15:00.000Z,
      earningsTimestampEnd: 2018-08-06T20:15:00.000Z,
      tradeable: false,
      cryptoTradeable: false,
      symbol: 'CRD.B'
    }
  },
  {
    instancePath: '/0',
    schemaPath: '#/anyOf',
    keyword: 'anyOf',
    params: {},
    message: 'must match a schema in anyOf',
    data: {
      language: 'en-US',
      region: 'US',
      quoteType: 'EQUITY',
      typeDisp: 'Equity',
      triggerable: false,
      customPriceAlertConfidence: 'LOW',
      esgPopulated: false,
      priceHint: 2,
      earningsTimestamp: 2018-08-06T20:15:00.000Z,
      earningsTimestampStart: 2018-08-06T20:15:00.000Z,
      earningsTimestampEnd: 2018-08-06T20:15:00.000Z,
      tradeable: false,
      cryptoTradeable: false,
      symbol: 'CRD.B'
    }
  }
]

This may happen intermittently and you should catch errors appropriately.
However:  1) if this recently started happening on every request for a symbol
that used to work, Yahoo may have changed their API.  2) If this happens on
every request for a symbol you've never used before, but not for other
symbols, you've found an edge-case (OR, we may just be protecting you from
"bad" data sometimes stored for e.g. misspelt symbols on Yahoo's side).
Please see if anyone has reported this previously:

  https://github.com/gadicc/node-yahoo-finance2/issues?q=is%3Aissue+Failed%20validation%3A%20%23%2Fdefinitions%2FQuoteResponseArray

or open a new issue (and mention the symbol):  yahoo-finance2 v2.3.10

  https://github.com/gadicc/node-yahoo-finance2/issues/new?labels=bug%2C+validation&template=validation.md&title=Failed%20validation%3A%20%23%2Fdefinitions%2FQuoteResponseArray

For information on how to turn off the above logging or skip these errors,
see https://github.com/gadicc/node-yahoo-finance2/tree/devel/docs/validation.md.

Failed Yahoo Schema validation CRD.B

Environment

Browser or Node: node
Node version (if applicable): 20.0
Npm version:
Browser verion (if applicable):
Library version (e.g. 1.10.1):

Additional Context

@pazer001 pazer001 added bug Something isn't working validation Issues related to validation labels Apr 22, 2023
@gadicc
Copy link
Owner

gadicc commented Apr 23, 2023

Hey @pazer001, thanks for another report.

This "looks" like a bug but it actually isn't. It's the "(OR, we may just be protecting you from "bad" data sometimes stored for e.g. misspelt symbols on Yahoo's side)" one.

I'll break it down symbol by symbol:

  • CRD.B - there's actually no such symbol. If you enter CRD.B on the Yahoo Finance website's autocomplete, you'll get a link to CRD.BK. Calling quote() on that gives you all the data you expect, without errors. Why does Yahoo's API still give you partial (but useless) data on an incorrect symbol name? It's anyone's guess... fortunately the validation catches this and prevents you from accidentally possessing this kind of bogus data.

  • MOG.A is likewise just a partial match. You should enter this in Yahoo Finance website, or use the search() method, to find the exact option you're looking for, e.g. MOGA230915C00105000, etc.

  • HEI.A - as above.

Hope this helps!

@gadicc gadicc added invalid This doesn't seem right and removed bug Something isn't working labels Apr 23, 2023
@pazer001
Copy link
Author

thanks, ill check.
i think the scraping of all yahoo's symbols found these symbols.
nevermind, not that critical since its hard for me to know what was the flow params i made for scraping so its hard for me to analyze.

@gadicc gadicc closed this as completed Aug 12, 2023
@gadicc
Copy link
Owner

gadicc commented Aug 12, 2023

Ok great, thanks for reporting back! 🙏

@martinnormark
Copy link
Contributor

I seem to be getting this error for AAPL:

"schemaPath": "#/definitions/QuoteEquity/additionalProperties",
"keyword": "additionalProperties",
"params": {
  "additionalProperty": "fiftyTwoWeekChangePercent"
},
"message": "must NOT have additional properties",

gadicc added a commit that referenced this issue Sep 3, 2023
 "pageViewGrowthWeekly",
         "openInterest",
+        "dividendRate",
+        "dividendYield",
         "headSymbolAsString",
         "contractSymbol",
         "underlyingExchangeSymbol",
diff --git a/src/modules/quote.ts b/src/modules/quote.ts
index 209862d..08cb5ab 100644
--- a/src/modules/quote.ts
+++ b/src/modules/quote.ts
@@ -37,6 +37,7 @@ export interface QuoteBase {
   fiftyTwoWeekHighChangePercent?: number; // -0.07712155,
   fiftyTwoWeekLow?: number; // 180.68,
   fiftyTwoWeekHigh?: number; // 589.07,
+  fiftyTwoWeekChangePercent?: number; // 22.604025
@gadicc
Copy link
Owner

gadicc commented Sep 3, 2023

Thanks for the report, @martinnormark.

What version of yahoo-finance2 are you using? We've been quite permissive about "additional properties" for a while now, but maybe there's a bug somewhere.

In any case, I added fiftyTwoWeekChangePercent a long with two other new properties, dividendRate and `dividendYield. It will be in the next release and there'll be an automated message here when its published. Thanks again.

@martinnormark
Copy link
Contributor

I'm using v2.4.4 - thanks for swift response, I temporarily disabled validation for this request.

I tried to find guidelines on how to easily refresh the schema test files, I looked at your recent change at it seems to be autogenerated. Is there a script to generate the test files Quote-AAPL.json?

gadicc added a commit that referenced this issue Sep 3, 2023
note, this is an empty commit, since the previous commit,
3bdc29a, had a badly formatted
commit message that did not trigger a new semantic release
gadicc pushed a commit that referenced this issue Sep 3, 2023
## [2.4.5](v2.4.4...v2.4.5) (2023-09-03)

### Bug Fixes

* **quote:** schema dividend{Rate,Yield}, 52wkChngPercent (fixes [#636](#636)) ([4e6ed20](4e6ed20))
@gadicc
Copy link
Owner

gadicc commented Sep 3, 2023

🎉 This issue has been resolved in version 2.4.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

@gadicc gadicc added the released label Sep 3, 2023
@gadicc
Copy link
Owner

gadicc commented Sep 3, 2023

My pleasure. And good question!

There's some info about this in the docs, but maybe it's not so easy to find. See https://github.com/gadicc/node-yahoo-finance2/blob/devel/docs/validation.md#help-fix, especially the section at the very bottom. But briefly:

  1. The source of the schema are the typescript definitions in e.g. quote.ts.
  2. yarn schema will regenerate the schema.json from the source files.
  3. The tests specify a filename using e.g. { devel: quote-AAPL.json }. If the file already exists, the result is used. If it doesn't exist, a new request will be made and the result saved/cached for future use.

The last point (3) above means if all tests are passing but we want to see if something in the Yahoo response has changed, we can simply delete the cached json file, rerun the test, and see if it still passes. Otherwise make changes to accommodate the new information being returned.

Hope this helps... very happy to help others who want to get involved contributing validation updates :)

gadicc pushed a commit that referenced this issue Sep 4, 2023
## [2.4.5](v2.4.4...v2.4.5) (2023-09-03)

### Bug Fixes

* **quote:** schema dividend{Rate,Yield}, 52wkChngPercent (fixes [#636](#636)) ([4e6ed20](4e6ed20))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right released validation Issues related to validation
Projects
None yet
Development

No branches or pull requests

3 participants