Skip to content

Javascript all-objects output should export all converters #1655

Description

@W1M0R

Version

quicktype version 15.0.258

Command

quicktype \
  --src-lang schema \
  json.schema \
  --lang js \
  --runtime-typecheck \
  --acronym-style pascal \
  --converters all-objects \
  --raw-type any \
  -o output.js

Actual Output

output.js:

...
function toData(json) {
    return cast(json, r("Data"));
}

function dataToJson(value) {
    return uncast(value, r("Data"));
}

function toData123(json) {
    return cast(json, r("Data123"));
}

function data123ToJson(value) {
    return uncast(value, r("Data123"));
}
...
module.exports = {
    "dataToJson": dataToJson,
    "toData": toData,
};

Expected Output

Expected output should also export data123ToJson and toData123:

...
module.exports = {
    "dataToJson": dataToJson,
    "toData": toData,
    "data123ToJson": data123ToJson,
    "toData123": toData123,
};

Explanation

Currently the user is able to create converters for all-objects, but those converters can not be used, since they are not exported. @benquarmby @schani

Related

#1236

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