Skip to content

Instantly share code, notes, and snippets.

View frantuma's full-sized avatar

Francesco Tumanischvili frantuma

View GitHub Profile
extends: spectral:oas
rules:
oas3-schema: error
info-contact: off
paths-kebab-case:
description: Paths should be kebab-case.
message: "gist spectral-valid.yaml {{property}} AAAAshould be kebab-case (lower-case and separated with hyphens)"
severity: warn
given: $.paths[*]~
then:
openapi: 3.0.4
info:
title: Swagger Petstore - OpenAPI 3.0
description: |-
This is a sample Pet Store Server based on the OpenAPI 3.0 specification. You can find out more about
Swagger at [https://swagger.io](https://swagger.io). In the third iteration of the pet store, we've switched to the design first approach!
You can now help us improve the API whether it's by making changes to the definition itself or to the code.
That way, with time, we can improve the API in general, and expose some of the new features in OAS3.
Some useful links:
# OpenAPI version identifier - required for OpenAPI 3.0 domains
openapi: 3.0.0
#######################
# Optional info section
#######################
info:
title: Acme Components
description: Common components for Acme REST APIs
version: '2'
openapi: 3.0.3
info:
version: "1.0.0"
title: Simple Inventory API
paths:
/inventory:
get:
operationId: searchInventory
parameters:
- in: header
{
"openapi" : "3.1.0",
"info" : {
"title" : "Swagger Petstore - OpenAPI 3.1",
"description" : "This is a sample Pet Store Server based on the OpenAPI 3.1 specification.\nYou can find out more about\nSwagger at [http://swagger.io](http://swagger.io).",
"termsOfService" : "http://swagger.io/terms/",
"contact" : {
"email" : "apiteam@swagger.io"
},
"license" : {
{
"openapi" : "3.1.0",
"info" : {
"title" : "Swagger Petstore - OpenAPI 3.1",
"description" : "This is a sample Pet Store Server based on the OpenAPI 3.1 specification.\nYou can find out more about\nSwagger at [http://swagger.io](http://swagger.io).",
"termsOfService" : "http://swagger.io/terms/",
"contact" : {
"email" : "apiteam@swagger.io"
},
"license" : {
{
"openapi" : "3.1.0",
"info" : {
"title" : "Swagger Petstore - OpenAPI 3.1",
"description" : "This is a sample Pet Store Server based on the OpenAPI 3.1 specification.\nYou can find out more about\nSwagger at [http://swagger.io](http://swagger.io).",
"termsOfService" : "http://swagger.io/terms/",
"contact" : {
"email" : "apiteam@swagger.io"
},
"license" : {
/*
validateReference sync execution with refSet caching
*/
import { CodeAction, Diagnostic, DiagnosticSeverity, Range } from 'vscode-languageserver-types';
import { TextDocument } from 'vscode-languageserver-textdocument';
import { Element, findAtOffset, traverse, ObjectElement } from '@swagger-api/apidom-core';
import { CodeActionKind, CodeActionParams } from 'vscode-languageserver-protocol';
import { evaluate, evaluateMulti } from '@swagger-api/apidom-json-path';
import { dereferenceApiDOM, Reference, ReferenceSet } from '@swagger-api/apidom-reference';
/*
validateReference concurrent execution with no refSet caching
*/
import { CodeAction, Diagnostic, DiagnosticSeverity, Range } from 'vscode-languageserver-types';
import { TextDocument } from 'vscode-languageserver-textdocument';
import { Element, findAtOffset, traverse, ObjectElement } from '@swagger-api/apidom-core';
import { CodeActionKind, CodeActionParams } from 'vscode-languageserver-protocol';
@frantuma
frantuma / petstore31.json
Created August 29, 2023 07:54
petstore31.json
{
"openapi" : "3.1.0",
"info" : {
"title" : "Swagger Petstore - OpenAPI 3.1",
"description" : "This is a sample Pet Store Server based on the OpenAPI 3.1 specification.\nYou can find out more about\nSwagger at [http://swagger.io](http://swagger.io).",
"termsOfService" : "http://swagger.io/terms/",
"contact" : {
"email" : "apiteam@swagger.io"
},
"license" : {