Coder Social home page Coder Social logo

Comments (5)

arutkowski00 avatar arutkowski00 commented on July 16, 2024 8

I have exactly the same issue. Look at the generated TS code:

export enum SortDir {
    Undefined = 0,
    Asc = 1,
    Desc = 2,
}

export enum sortDir {
    Undefined = 0,
    Asc = 1,
    Desc = 2,
}

export enum sortDir2 {
    Undefined = 0,
    Asc = 1,
    Desc = 2,
}

export enum sortDir3 {
    Undefined = 0,
    Asc = 1,
    Desc = 2,
}

export enum sortDir4 {
    Undefined = 0,
    Asc = 1,
    Desc = 2,
}

export enum sortDir5 {
    Undefined = 0,
    Asc = 1,
    Desc = 2,
}

from njsonschema.

kpol avatar kpol commented on July 16, 2024 3

I created this simple class https://gist.github.com/kpol/3e76ecf37024d4be364f8a5782557f9a to merge enums based on enum fullname (added this metadata as a vendor extension on service-side [Swashbuckle]). This class pre-process Swagger spec file for NSwag
Swagger spec example:

{
	"name": "enumA",
	"in": "query",
	"required": true,
	"type": "string",
	"enum": ["A", "B"],
	"x-nullable": false,
	"x-type-fullname": "WebTest.EnumA"
}

from njsonschema.

RouR avatar RouR commented on July 16, 2024 2

@kpol How to use it?

from njsonschema.

RicoSuter avatar RicoSuter commented on July 16, 2024

Should look like:

var schema = JsonSchema4.FromType<Person>();

var transformation = new MergeEnumerationsTransformation();
transformation.Transform(schema);

var json = schema.ToJson();

Compare enum schemes by serializing the schema and compare the strings...

from njsonschema.

RicoSuter avatar RicoSuter commented on July 16, 2024

Maybe insteadof modifing the doc we could also integrate this into the resolver and merge on the fly?

from njsonschema.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.