Skip to content

nango.yaml: string literals that start with a digit (7d, 2fa) are parsed as numbers #7668

Description

@breken-ai

getNativeDataType() in packages/nango-yaml/lib/helpers.ts uses parseInt(value, 10), which reads the leading digits of any string. So a model like:

models:
  Report:
    period: 7d | 30d | 90d
    factor: 2fa

is parsed as period: 7 | 30 | 90 and factor: 2, and the generated models.ts types the fields as numbers. 1.5 is also cut to 1. Only a whole numeric token should become a number literal.

Suggested fix (regex check + 2 unit tests): breken-ai/nango@master...fix/yaml-numeric-prefix-literals

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions