Skip to content

Instantly share code, notes, and snippets.

.components.securitySchemes={ "ApiKeyAuth" : { "type": "apiKey", "in" : "header", "name" : "X-Gravitee-Api-Key"}} | .paths[]?[]?.security = [{"ApiKeyAuth" : []}]
@mcroissant
mcroissant / spectral-custom-rule.yaml
Created April 26, 2021 14:51
Spectral custom rule to check https
extends: spectral:oas
rules:
endpoint-should-be-https:
description: Endpoints should be using https
given: $.servers[*]
severity: error
then:
field: url
function: pattern
functionOptions:
@mcroissant
mcroissant / spectral-gitlab-ci.yaml
Created April 26, 2021 14:35
Gitlab CI for spectral API validation
stages:
- validate
validate_open-api:
stage: validate
image:
name: stoplight/spectral
entrypoint: [""]
script:
- spectral lint request-apispec.json -f junit -o api-report.xml
@mcroissant
mcroissant / maven_springdoc_spec.xml
Created April 26, 2021 14:25
Maven OpenAPI Spec generation with springdoc
...
<build>
<plugins>
...
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>VERSION HERE</version>
<configuration>
@mcroissant
mcroissant / sila_full_feature
Created November 19, 2019 11:52
Sila2 storage feature definition
<?xml version="1.0" encoding="utf-8" ?>
<Feature SiLA2Version="0.1" FeatureVersion="1.0" Originator="org.silastandard" Category="examples"
xmlns="http://www.sila-standard.org"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sila-standard.org https://gitlab.com/SiLA2/sila_base/raw/master/schema/FeatureDefinition.xsd">
<Identifier>AutomatedStorage</Identifier>
<DisplayName>Automated Storage</DisplayName>
<Description>Feature allowing to interact with automated storage remote controls</Description>
<DataTypeDefinition>
@mcroissant
mcroissant / sila_data_type_definition_usage.xml
Created November 19, 2019 11:48
SiLA2 Data Type Definition call
<Command>
...
<Parameter>
...
<DataType>
<DataTypeIdentifier>Rack</DataTypeIdentifier>
</DataType>
</Parameter>
...
</Command>
@mcroissant
mcroissant / sila_data_type_definition.xml
Created November 19, 2019 11:42
Sila2 Data Type Definition
<DataTypeDefinition>
<Identifier>Rack</Identifier>
<DisplayName>Rack</DisplayName>
<Description>Rack entity containing containers </Description>
<DataType>
...
</DataType>
</DataTypeDefinition>
@mcroissant
mcroissant / sila_simple_property.xml
Last active October 17, 2019 15:51
SiLA Property definition
<Feature>
...
<Property>
<Identifier>FreezerTemperature</Identifier>
<DisplayName>Freezer Temperature</DisplayName>
<Description>The current temperature of the freezer</Description>
<DataType>
<Basic>Real</Basic>
</DataType>
<Observable>Yes</Observable>
@mcroissant
mcroissant / complex_list_parameter.xml
Created October 17, 2019 15:36
Complex parameter with a list and structure
<Command>
...
<Parameter>
<Identifier>ExpectedRackContent</Identifier>
<DisplayName>Expected Rack Content</DisplayName>
<Description>The vials barcode and position which are expected within the rack</Description>
<DataType>
<List>
<DataType>
<Structure>
@mcroissant
mcroissant / simple_sila_parameter.xml
Created October 17, 2019 15:23
Simple SiLA Parameter
<Command>
...
<Parameter>
<Identifier>RackBarcode</Identifier>
<DisplayName>Rack Barcode</DisplayName>
<Description>The barcode of the rack that will be inserted into the automated freezer</Description>
<DataType>
<Basic>String</Basic>
</DataType>
</Parameter>