Giter VIP home page Giter VIP logo

Comments (8)

javierbrea avatar javierbrea commented on June 3, 2024

Hello @doox911 , it seems that you don't have a "base" collection (note the second warning displayed when you start the server). So, the plugin is not able to create the collection and routes because this produces an error.

You can remove the from property in the plugin options, and the collection will contain only the routes created by the openapi definition, or you can provide a valid collection to extend from.

from main.

doox911 avatar doox911 commented on June 3, 2024

Hello @doox911 , it seems that you don't have a "base" collection (note the second warning displayed when you start the server). So, the plugin is not able to create the collection and routes because this produces an error.

You can remove the from property in the plugin options, and the collection will contain only the routes created by the openapi definition, or you can provide a valid collection to extend from.

I tryed:

// For a detailed explanation regarding each configuration property, visit:
// https://www.mocks-server.org/docs/configuration/how-to-change-settings
// https://www.mocks-server.org/docs/configuration/options

module.exports = {
  plugins: {
    openapi: {
      collection: {
        id: 'all-routes',
      },
    },
  },
};

And:

// For a detailed explanation regarding each configuration property, visit:
// https://www.mocks-server.org/docs/configuration/how-to-change-settings
// https://www.mocks-server.org/docs/configuration/options

module.exports = {
  plugins: {
    openapi: {},
  },
};

And I get:

────────────────────────────────────────────────────────────
⚠️  ALERTS
────────────────────────────────────────────────────────────
‧ Warning: [mock:collections:selected] Option 'mock.collections.selected' was not defined. Selecting the first collection found

────────────────────────────────────────────────────────────
ℹ️  CURRENT SETTINGS
────────────────────────────────────────────────────────────
‧ Server listening at: http://localhost:3100
‧ Delay: 0
‧ Current collection: openapi
‧ Collections: 1
‧ Routes: 0
‧ Route variants: 0
‧ Log level: info
‧ Watch enabled: true

────────────────────────────────────────────────────────────
↕️  ACTIONS
────────────────────────────────────────────────────────────
? Select action: (Use arrow keys)
> Select collection 
  Use route variant 
  Restore route variants 
  Change delay 
  Restart server 
  Change log level 
  Switch watch 
(Move up and down to reveal more choices)

Please, give me a schema (json) that should work. 🙏

from main.

javierbrea avatar javierbrea commented on June 3, 2024

Now, according to the logs, you don't have an error related to the configuration of the plugin, but it seems that your openAPI definition is not generating any route.

You can disable the inquirerCli plugin and increase the log level to see why. But I recommend you to review the documentation about how Mocks Server converts OpenAPI docs into routes, so you can check if your OpenAPI definitions are compatible with the plugin, or if you have to add some properties in order to allow the server to detect and generate routes.

from main.

doox911 avatar doox911 commented on June 3, 2024

inquirerCli

Screenshot_55

"paths": {
    "/auth/access-token": {
      "post": {
        "tags": ["AuthController"],
        "summary": "Get access token",
        "operationId": "getAccessToken",
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "required": ["code", "redirect-uri"],
                "type": "object",
                "properties": {
                  "code": { "type": "string", "description": "Code" },
                  "redirect-uri": { "type": "string", "description": "Redirect-uri" }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": { "*/*": { "schema": { "$ref": "#/components/schemas/TokenDTO" } } }
          }
        }
      }
    },
 }

from main.

javierbrea avatar javierbrea commented on June 3, 2024

Hi again @doox911 , I'm sorry but, as you can read in the docs, routes are generated from a combination of the OpenAPI paths, the methods, the examples in the responses, some custom properties that can be defined, etc. So, please read the docs deeply and be more specific in your comments. If you find something that it is not working according to the docs, or if you don't understand an specific point, I'll be happy to help you.

from main.

doox911 avatar doox911 commented on June 3, 2024

Hi again @doox911 , I'm sorry but, as you can read in the docs, routes are generated from a combination of the OpenAPI paths, the methods, the examples in the responses, some custom properties that can be defined, etc. So, please read the docs deeply and be more specific in your comments. If you find something that it is not working according to the docs, or if you don't understand an specific point, I'll be happy to help you.

I have read and the only difference is the lack of examples in the Openapi schema, right? I really don't understand what is missing to create routes at least?

from main.

doox911 avatar doox911 commented on June 3, 2024

Hi again @doox911 , I'm sorry but, as you can read in the docs, routes are generated from a combination of the OpenAPI paths, the methods, the examples in the responses, some custom properties that can be defined, etc. So, please read the docs deeply and be more specific in your comments. If you find something that it is not working according to the docs, or if you don't understand an specific point, I'll be happy to help you.

Hurray! It turns out that nothing is created without examples... Thank you for your help!

from main.

javierbrea avatar javierbrea commented on June 3, 2024

Hi again @doox911 , I'm sorry but, as you can read in the docs, routes are generated from a combination of the OpenAPI paths, the methods, the examples in the responses, some custom properties that can be defined, etc. So, please read the docs deeply and be more specific in your comments. If you find something that it is not working according to the docs, or if you don't understand an specific point, I'll be happy to help you.

Hurray! It turns out that nothing is created without examples... Thank you for your help!

Yes, that's right, examples are needed because it has no sense to create route variants for sending anything 😉 . I'm glad you found the problem.

from main.

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.