Git Product home page Git Product logo

Comments (3)

JamesMessinger avatar JamesMessinger commented on June 18, 2024

The current mock-data generation code is far too simplistic and will need to be enhanced.

Currently, it just generates random values based on the data type, min/max length, and min/max values specified in the JSON Schema. This should be enhanced to use a library such as Faker to generate more realistic mock data. This way, a property named "firstName" would have mock data like "John", "David", or "Sarah", rather than a random string like "a9d72jdk1jdhqjd187snd". We should also provide some mechanism for API authors to specify the type of data to generate, since we won't always be able to determine based on the property name.

Also, we need to enhance the code to support complex JSON schemas. Currently, it supports primitive types (string, number, date, etc.), arrays, and objects. But it doesn't support JSON schema values such as oneOf, anyOf, allOf, patternProperties, etc.

from swagger-express-middleware.

brettdh avatar brettdh commented on June 18, 2024

Just chiming in with a note that I ran into the lack of oneOf support in the mock middleware today with a Swagger spec from an Oracle API.

I may have time to work on this, but I'm not at all sure about that.

from swagger-express-middleware.

brettdh avatar brettdh commented on June 18, 2024

In my case, however, it turns out that every array type is actually just [<supported type>, "null"], so I can work around this limitation by replacing that with just the supported type before passing the schema to the mock middleware. 🎉

from swagger-express-middleware.

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.