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

It generates to much underlines #17

Open
stepanhakobyan opened this issue Apr 1, 2019 · 0 comments
Open

It generates to much underlines #17

stepanhakobyan opened this issue Apr 1, 2019 · 0 comments

Comments

@stepanhakobyan
Copy link

When there is a property named "__metadata", json-ts generates "___metadata" with 3 underlines instead of two.
Same problem is with 3, 4 and so on.
It works well with 1 underline only.

Here is an example, a cropped down json received from SharePoint api,
There are "__metadata" and "__deferred" and generation is incorrect in both cases.

{
    "d": {
      "__metadata": {
        "id": "5206ff12-fa86-4b93-8b1a-51d6d8f8d42c",
        "uri": "https://spserver2016.armsoft.am/_api/Web/Lists(guid'2ff3c593-f85c-41fe-a5c1-3ff11cfe455f')/Items(1591)",
        "etag": "\"2\"",
        "type": "SP.Data.ReviewListItem"
      },
      "FirstUniqueAncestorSecurableObject": {
        "__deferred": {
          "uri": "https://spserver2016.armsoft.am/_api/Web/Lists(guid'2ff3c593-f85c-41fe-a5c1-3ff11cfe455f')/Items(1591)/FirstUniqueAncestorSecurableObject"
        }
      },
      "FileSystemObjectType": 1,
      "Id": 1591
    }
  }

and the generated code is

interface IRootObject {
    d: ID;
}
interface ID {
    ___metadata: I___metadata;
    FirstUniqueAncestorSecurableObject: IFirstUniqueAncestorSecurableObject;
    FileSystemObjectType: number;
    Id: number;
}
interface I___metadata {
    id: string;
    uri: string;
    etag: string;
    type: string;
}
interface IFirstUniqueAncestorSecurableObject {
    ___deferred: I___deferred;
}
interface I___deferred {
    uri: string;
}
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

No branches or pull requests

1 participant