question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

feature: generate schema from class

See original GitHub issue

I see that it is possible to use a json schema to validate against. Is it also possible to generate the schema from the class?

I am currently using simpl-schema which has a great ecosystem (e,g, auto generating forms) However, I want to move away from json based schemas towards a more modern approach (i.e. class-validator package), but now I would need to define everything twice (decorators & json schema). Generating the schema from decorators would prevent a lot of duplicate code.

I don’t really care about the syntax/structure of the generated json schema since I can just write a transformer to generate the simpl-schema syntax from it.

I also don’t mind contributing if you can point me into the right direction. I would need some way to get all validator types and their arguments:

schema = {}
properties.forEach(property => {
    property.validators.forEach(validator => {
            schema[property.name][validator.name] = validator.value
    })
})

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
breath103commented, Jan 9, 2018

is there any progress on this? it would be really nice to have this feature.

0reactions
github-actions[bot]commented, Dec 18, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Schema—ArcGIS Pro | Documentation
Only output feature classes, tables, rasters, and workspaces have a schema—other types do not. The Schema object is created for you in geoprocessing...
Read more >
Generating XML Schemas from Classes
Describes how to generate XML schemas from XML-enabled classes by using %XML.Schema.
Read more >
c# - How to create a XSD schema from a class? - Stack Overflow
Compile your project! · Click on the class in Solution Explorer. · Click Tools, Create Schema From Class · Click on the Show...
Read more >
Creating empty feature class in file geodatabase based on ...
Just use the CreateFeatureClass tool, passing the original feature class as the template argument. Grab the shape type from the Describe ...
Read more >
How To: Import the schema from one feature class to another ...
A schema defines the physical structure of the geodatabase along with rules, relationships, and properties of each dataset in the geodatabase.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found