Skip to content

Instantly share code, notes, and snippets.

View ponelat's full-sized avatar

Josh Ponelat ponelat

View GitHub Profile
@ponelat
ponelat / openapi.oas2.yml
Created December 14, 2021 10:35
Multiple basePath not a feature
swagger: "2.0"
info:
title: Multiple basePaths
version: 1.0.0
description: |
Multiple basePaths aren't a feature in OpenAPI 2.0 (fka Swagger 2.0).
A basePath only works if _all_ your endpoints have it in there.
If your endpoints don't all share a comman basePath, you should leave it as `/` or blank.
@ponelat
ponelat / openapi.oas2.yml
Created November 30, 2021 11:57
timestamp issue in codegen
swagger: '2.0'
info:
title: Example to describe swagger codegen issue
description: |
Example Definition with Timestamp class as `java.sql.Timestamp` instead of custom model.
version: v1
paths:
/foo:
post:
@ponelat
ponelat / oas31.yml
Created November 29, 2021 10:05
Using oneOf in bodies
openapi: 3.0.3
info:
title: Example multiple responses
description: Example of multiple responses
version: 1.0.0
paths:
/one:
post:
description: Multiple request/response types.
@ponelat
ponelat / README.md
Last active November 23, 2021 13:52
Overlay for generated OpenAPI definition

Generated OpenAPI definition with Overlay

This is to demonstrate the use-case of Overlays for documentation writers.

The original.json file was generated from a swagger-core sample (aka Code-first) and original.yml is the same definition but in YAML.

This is an effort of using real tools and as close to real issues as possible. Instead of simpler conrvied examples, although going forward simpler examples will be better (for readability at least)!

When we stick this into https://editor.swagger.io we find the following errors...

@ponelat
ponelat / openapi.yml
Created November 17, 2021 14:29
XML Attribute in OpenAPI
openapi: 3.0.1
info:
version: 1.1.1
title: XML attributes
paths:
/foo:
get:
responses:
default:
description: ok
@ponelat
ponelat / openapi.yml
Created November 16, 2021 15:33
Recursive rendering issue
swagger: '2.0'
info:
title: Recursive
description: Recursive
version: 1.0.0
paths:
/foo:
get:
description: ok
@ponelat
ponelat / petstore-k8s.yml
Created November 4, 2021 08:20
Petstore (demo server + swagger-ui) k8s resource
apiVersion: apps/v1
kind: ReplicaSet
metadata:
name: petstore
namespace: default
labels:
app: petstore
spec:
replicas: 1
selector:
@ponelat
ponelat / spec.md
Last active November 29, 2024 07:36
JSON Pointer Query (JPQ)

JSON Pointer Query - RFC

A query language aimed at identifying locations within a JSON/YAML document. Inspired by JSON Pointer. This is heavily influenced by JSON Path of which it shares maybe 80% of the syntax. It didn't start of sharing that much but has grown towards JSON Path, as problems were solved.

The design goals

  • Only identify locations in a JSON-like document.
  • Only aim for 80% of use cases and leave more powerful features to other query languagse.
  • Be specified (ie: versioned and complete)
  • Do not rely on implementation details
@ponelat
ponelat / index.html
Last active August 24, 2021 15:02
Changing the Generator API endpoints for Swagger Editor
<!DOCTYPE html>
<!-- HTML for static distribution bundle build -->
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Swagger Editor</title>
<style>
* {
box-sizing: border-box;
}
@ponelat
ponelat / openapi.yml
Created July 5, 2021 14:46
additional-prop-with-example
openapi: 3.0.0
info:
version: abc
title: Showing a generated example for `additionalProperties`
paths:
/foo:
get:
description: ok