Comments (8)
This would be a killer feature for us. We want to use openapi-cli as a linter that enforces a consistent folder/file structure in all of our APIs, so any developer in the company can easily work on any API in the company without having to learn a new structure each time. Here's the structure that we're enforcing:
|-- openapi.yaml (the main/entry file)
|-- info.yaml (the info section)
|-- tags.yaml (the tags section)
|-- paths/
| |-- foo/
| |-- bar/
| |-- path.yaml (the definition of the /foo/bar path)
| |-- get.yaml (the definition of the GET /foo/bar operation)
| |-- post.yaml (the definition of the POST /foo/bar operation)
|
|-- schemas/
|-- enums.yaml (all enumerations are defined here)
|-- fizz.yaml (the JSON schema for fizz objects)
|-- buzz.yaml (the JSON schema for buzz objects)
So we need to be able to create file-level rules such as:
- The main entry file of the API definition must be named
openapi.yaml
info.yaml
must exist and must contain the API's info sectiontags.yaml
must exist and must contain the list of tags- Every path in the API must have a corresponding
paths/xxx/yyy/path.yaml
file - Every operation in the API must have a corresponding
paths/xxx/yyy/VERB.yaml
file - Every object schema must be defined in a corresponding
schemas/xxx.yaml
file - All enumerations must be in
enums.yaml
- The enumerations in
enums.yaml
must be in alphabetical order
from redocly-cli.
Oh, that's an interesting idea. We're not sure how to fit into our internal concept.
We will discuss it internally and get back to you soon.
from redocly-cli.
@JamesMessinger what are you doing in the case of path parameters with your paths folder structure? For example:
- foo/get.yaml <-- gets a collection of foos
- foo/{id}/get.yaml <-- gets a foo with a specific {id}
from redocly-cli.
Yes, exactly. Path parameters are just part of the folder structure.
from redocly-cli.
This is done (I think). @RomanHotsiy we should add an example of enforcing file names. For example, Rebilly uses PascalCase
for component file names with two exceptions: headers (some hybrid of kebab-case and PascalCase == Kebab-Case
) and parameters (camelCase
). How about a sample rule that enforces a particular case for filenames.
from redocly-cli.
@RomanHotsiy this is effectively done with the $ref assertion, right?
from redocly-cli.
Not exactly but it can be used for some file-names checks for sure.
from redocly-cli.
I'm going to close this since it can be used for $ref
filename checks. I'm not sure what other filename would want to be checked besides the root file?
from redocly-cli.
Related Issues (20)
- $ref replaces object on bundle, 3.1.0 spec not working when using siblings HOT 1
- redocly bundle with a reference to a JSON schema root object produces invalid OpenAPI spec HOT 2
- Detect properties with no type defined HOT 5
- Support SARIF as output for redocly lint command.
- Example validation is not done against the schema HOT 7
- bundle command converts floating point numbers to integers HOT 1
- Self-referencing circular pointer HOT 2
- Allow specifying an overwrite conflict strategy for the `join` command HOT 1
- Add docs for Arazzo linting
- Linting does not catch default value types not conforming to specified field type HOT 2
- Translations and eject command wrapper
- Using curl instead of the cli interface HOT 2
- Add `boolean-schema-prefixes` (analogue to `boolean-parameter-prefixes`) rule to schema/model validation HOT 2
- root level paths `/` are not split correctly HOT 1
- Suppress update now logging HOT 1
- Pattern properties casing triggers error after upgrade, possible regression with 1.18.1 release HOT 1
- [OAS 3 spec] License object `identifier` and `url` keys are mutually-exclusive HOT 6
- Cannot find module './types/arazzo' HOT 6
- Remove all usages of component marked x-internal HOT 5
- hideRightPanel configuration does not have any effect
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 redocly-cli.