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 Yahoo Schema validation #839

Open
tamir-ferreira opened this issue Nov 15, 2024 · 1 comment
Open

Failed Yahoo Schema validation #839

tamir-ferreira opened this issue Nov 15, 2024 · 1 comment
Labels
bug Something isn't working validation Issues related to validation

Comments

@tamir-ferreira
Copy link

Validation Error

Minimal Reproduction

await yahooFinance.quoteSummary('BEEF3.SA", { modules: [ 'price', 'summaryDetail', 'financialData', 'defaultKeyStatistics', 'assetProfile', ], });

Symbol(s) that it happened for

  • BEEF3.SA

Error Message

  "type": 62,
  "schema": {
    "title": "YahooNumber",
    "anyOf": [
      {
        "title": "RawNumber",
        "type": "object",
        "properties": {
          "raw": {
            "type": "number"
          }
        },
        "required": [
          "raw"
        ]
      },
      {
        "type": "number"
      }
    ]
  },
  "path": "/summaryDetail/trailingPE",
  "value": "Infinity",
  "message": "Expected union value"
}

Environment

Browser or Node: Node
Node version (if applicable): v20.16.0
Npm version: 10.8.2
Browser version (if applicable):
Library version (e.g. 1.10.1): 2.13.2

Additional Context

@tamir-ferreira tamir-ferreira added bug Something isn't working validation Issues related to validation labels Nov 15, 2024
@gadicc
Copy link
Owner

gadicc commented Dec 21, 2024

Hey, thanks for your report and patience.

I think this might be a case of us protecting you from "bad" Yahoo data? Because what does it even mean that they have a P/E ratio of "infinity" ? 😅

I would probably try/catch this error and strip out that value (or disable validation and do my own checks). But if I'm missing something here, let me know. How would you ideally process { trailingPE: "Infinity" } ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working validation Issues related to validation
Projects
None yet
Development

No branches or pull requests

2 participants