Comments (3)
@wedi I ll make a PR as soon as I have some time.
I ll make it a separate cli option, so that you can have the choice if you want to split the config or have 1 central file.
from openapi-format.
@wedi Thanks (again) for the valuable feedback.
Which configurations would you like to see merged?
In the CI flow, that we are using, we use it to format and filter 1 OpenAPI and store multiple results in seperate OpenAPI files.
Example:
- public documentation for production
- internal preview documentation (which contains upcoming endpoints)
- an OpenAPI for Newman with a subset for tests.
from openapi-format.
That's a pretty neat workflow and I believe my suggestion wouldn't break it. You could keep the existing parameters and document that they overwrite the combined config file. (Although that might make it more complicated than it needs to be.)
Which configurations would you like to see merged?
All of them. 🤓 Similar to this:
{
"file": "src/openapi.yaml", // file and string or files and [] if you decide to allow multiple (globs)
"filter": {
"methods": [],
"tags": [],
"operationIds": [],
"operations": [],
"flags": [],
"flagValues": [],
"unusedComponents": [],
"stripFlags": []
},
"lineWidth": -1, // maybe 0 should do the same?
"sort": { // set to false for `no-sort`
"root": ["openapi", "info", "servers", "paths", "components", "tags", "x-tagGroups", "externalDocs"],
"get": ["operationId", "summary", "description", "parameters", "requestBody", "responses"],
"post": ["operationId", "summary", "description", "parameters", "requestBody", "responses"],
"put": ["operationId", "summary", "description", "parameters", "requestBody", "responses"],
"patch": ["operationId", "summary", "description", "parameters", "requestBody", "responses"],
"delete": ["operationId", "summary", "description", "parameters", "requestBody", "responses"],
"parameters": ["name", "in", "description", "required", "schema"],
"requestBody": ["description", "headers", "content", "links"],
"responses": ["description", "headers", "content", "links"],
"content": [],
"components": ["parameters", "schemas"],
"schema": ["description", "type", "items", "properties", "format", "example", "default"],
"schemas": ["description", "type", "items", "properties", "format", "example", "default"],
"properties": ["description", "type", "items", "format", "example", "default", "enum"]
},
"sort-components": [],
"verbose": false,
}
I have two reasons for this suggestion.
- Less clutter in already cluttered root directories
- It would allow to replace
openapi-format --sortFile .openapi-format-sort.json --sortComponentsFile .openapi-format-sort-components.json --filterFile .openapi-format-filter.json src/openapi.yaml -o src/openapi.yaml
with
openapi-format src/openapi.yaml -o src/openapi.yaml
or evenopenapi-format .
per my other suggestion.
Looking at eslint and prettier it seems -c|--config
would be a sensible choice for a parameter to use a config file for a certain job and it would allow you to keep --configFile
for backwards compatibility if desired (but it would break -c
).
I digged into eslint and they use a highly customized config loader whereas prettier uses a library called cosmicconfig. They have lodash in their dependency list, too, so they might use that to merge with default settings.
from openapi-format.
Related Issues (20)
- 1.15.4 fails to locate the filter file path when set HOT 10
- some needed objects are filtered out when using inverseTags with unusedComponents HOT 3
- filtering unused components - not working HOT 2
- Issue with InverseOperationId while parsing Free-Form object. HOT 4
- yaml document start characters `---` & comments not preserved HOT 12
- Issues with cookie parameters being excluded from formatted document HOT 7
- Issue with combined usage Flags & FlagValues
- Format: Generate OAS properties like operationId
- CLI: option "convertTo" to transform OpenAPI 3.0 to 3.1 format HOT 1
- Keep $ref dereference when writing the update files HOT 3
- YAML empty objects get sripped away HOT 10
- "properties" casing changes not reflect in the "required" fields HOT 4
- Inverse flags HOT 11
- Some filtered fields are still present after formatting HOT 6
- sort - order not always preserved on certain sub-objects HOT 2
- sort - order request parameters by name HOT 4
- ConvertTo: downgrade 3.1 to 3.0 HOT 2
- examples with properties named "schemas" are rewritten to an object HOT 3
- Remove empty paths filter throws null error HOT 2
- Quotes around references to other files are incorrectly handled HOT 3
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 openapi-format.