Skip to content

Instantly share code, notes, and snippets.

@chanjarster
Last active November 19, 2019 09:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chanjarster/1b15cb781fcc91e2cd293fcc2b1682d2 to your computer and use it in GitHub Desktop.
Save chanjarster/1b15cb781fcc91e2cd293fcc2b1682d2 to your computer and use it in GitHub Desktop.
oas validator style check rules
# OpenAPI Object
openAPI.openapi.gte=3.0.2
openAPI.tags.size.gte=1
openAPI.security.size.eq=0
# Info Object
info.description.required=true
# Tag Object
tag.name.case=upper-camel-case
tag.name.must_be_referenced=true
tag.description.required=true
# Paths Object
paths.key.case=lower-camel-case
# Operation Object
operation.summary.required=true
operation.operationId.case=lower-camel-case
operation.tags.size.eq=1
operation.tags.element.must_reference_root_tags=true
operations.servers.size.eq=0
# Parameter Object
parameter.description.required=true
parameter.name.header.case=upper-hyphen-case
parameter.name.cookie.case=lower-camel-case
parameter.name.path.case=lower-camel-case
parameter.name.query.case=lower-camel-case
# RequestBody Object
requestBody.description.required=true
# Response Object
response.headers.key.case=upper-hyphen-case
# Schema Object
schema.title.required=true
schema.properties.key.case=lower-camel-case
# Encoding Object
encoding.headers.key.case=upper-hyphen-case
# Header Object
header.description.required=true
# Components Object
components.schemas.key.case=upper-camel-case
components.responses.key.case=upper-camel-case
components.parameters.key.case=upper-camel-case
components.examples.key.case=upper-camel-case
components.requestBodies.key.case=upper-camel-case
components.headers.key.case=upper-hyphen-case
components.links.key.case=upper-hyphen-case
components.callbacks.key.case=upper-camel-case
components.headers.key.case=upper-camel-case
# style check rule configuration based on:
# https://github.com/apache/servicecomb-toolkit/blob/c0baf5dff7d408d414bd40238b6849302ecc5b55/oas-validator/README.md#style-check-rules
# OpenAPI Object
openAPI:
openapi:
_gte: 3.0.2
# info property checking is delegated to Info Object checking
# paths property checking is delegated to Paths Object checking
# components property checking is delegated to Components Object checking
tags:
_size:
_gte: 1
# tags element checking is delegated to Tag Object checking
security:
_size:
_eq: 0
# Info Object
info:
description:
_required: true
# Tag Object
tag:
name:
_case: upper-camel-case
_check_if_be_referenced: true
description:
_required: true
# Paths Object
paths:
_key:
_case: lower-camel-case
# map value checking is delegated to Path Item Object checking
# Path Item Object
# get/post/put/delete/... property is delegated to Operation Object checking
# parameters property element checking is delegated to Parameter Object checking
# Operation Object
operation:
summary:
_required: true
operationId:
_case: lower-camel-case
# parameters property element checking is delegated to Parameter Object checking
# requestBody property element checking is delegated to RequestBody Object checking
# responses property element checking is delegated to Responses Object checking
tags:
_size:
_eq: 1
_element:
_check_if_exists_in_root_tags: true
servers:
_size:
_eq: 0
# Parameter Object
parameter:
description:
_required: true
name:
_case:
_in_header: upper-hyphen-case
_in_cookie: lower-camel-case
_in_path: lower-camel-case
_in_query: lower-camel-case
# schema property checking is delegated to Schema Object checking
# content property checking is delegated to MediaType Object checkings
# RequestBody Object
requestBody:
description:
_required: true
# content property checking is delegated to MediaType Object checkings
# MediaType Object
mediaType:
schema:
_required: true
# encoding property checking is delegated to MediaType Object checkings
# Responses Object
# 'http status code' property and 'default' property checking is delegated to Response Object checking
# Response Object
response:
description:
_required: true
headers:
_key:
_case: upper-hyphen-case
# content property checking is delegated to MediaType Object checking
# Schema Object
schema:
title:
_required: true
properties:
_key:
_case: lower-camel-case
# map value(Schema Object) checking is recursively delegated to it self
# Encoding Object
encoding:
headers:
_key:
_case: upper-hyphen-case
# map value(Header Object) is delegated to Header Object checking
# Header Object
header:
description:
_required: true
# schema property checking is delegated to Schema Object checkings
# content property checking is delegated to MediaType Object checkings
# Components Object
components:
schemas:
_key:
_case: upper-camel-case
# map value (Schema Object) checking is delegated to MediaType Object checkings
responses:
_key:
_case: upper-camel-case
# map value (Response Object) checking is delegated to Response Object checkings
parameters:
_key:
_case: upper-camel-case
# map value (Parameter Object) checking is delegated to Parameter Object checkings
examples:
_key:
_case: upper-camel-case
requestBodies:
_key:
_case: upper-camel-case
# map value (RequestBody Object) checking is delegated to RequestBody Object checkings
headers:
_key:
_case: upper-hyphen-case
# map value (Header Object) checking is delegated to Header Object checkings
links:
_key:
_case: upper-camel-case
callbacks:
_key:
_case: upper-camel-case
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment