Comments (8)
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.
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.
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.
inquirerCli
"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.
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.
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.
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.
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)
- OpenAPI remote example failing due to stringified json HOT 1
- Babel configuration ignored in docker container HOT 7
- Problems with Query Params path-to-regexp HOT 1
- File collections.json cannot be found when it is in the CWD HOT 1
- Import mockjs or other modules
- Publish Docker multi-platform images
- Please provide support of HAR files as a source of mocks HOT 1
- JavaScript API: createServer command with config object throws error "unknown option '--config'" HOT 2
- [object Object] header in OpenApi mocks
- Support TypeScript without the need for Babel HOT 1
- Creating-an-instance-with-pre-installed-plugins fails to start HOT 2
- mocks-server-lite - An Alternative HOT 4
- Build from YAML OpenAPI Spec Not Working HOT 4
- Plugin-admin-api - Impossibility to change the base server url (localhost) : when app deploy in production, requests fail
- Update dependencies HOT 1
- Remove parallel jobs from actions to be able to update Nx
- Update API documentation with TypeScript examples
- Finish TypeScript branch unit tests
- Development documentation
- Migrate website to the monorepo
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from main.