Skip to content

Schema export consistency #335

@Makeshift

Description

@Makeshift

Before I open a pull request for this, I was curious if there was a design reason for it.

I've noticed that the schema that is exported with getSchema and getSchemaString are not the same as the schema that was originally supplied to Convict. In particular, two transformations happen:

  1. The format name is made lowercase
  2. The JSON object is flattened (I assume to make a.b.c work without having to deal with walking through a nested object)

In my fork I've commented out the line that makes the format name lowercase, and introduced an unflattening function that is applied to getSchema and getSchemaString to obtain an output consistent with the schema you put in. I also output properties instead.

I was just wondering if there was a reason behind these design decisions before I opened a pull request to change them (although that would require a major version bump).

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