Skip to content

Commit

Permalink
Merge branch 'master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
ahl authored Oct 20, 2023
2 parents 5f652d7 + 9d7d07f commit b425e5c
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 34 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

jobs:
check-style:
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Report cargo version
Expand All @@ -25,7 +25,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-18.04, windows-2019, macos-10.15 ]
os: [ ubuntu-22.04, windows-2022, macos-12 ]
steps:
- uses: actions/checkout@v2
- name: Build
Expand Down
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "openapiv3"
version = "1.0.2"
version = "1.0.3"
authors = ["Glade Miller <[email protected]>"]
edition = "2018"
license = "MIT/Apache-2.0"
Expand All @@ -12,11 +12,11 @@ description = "This crate provides data structures that represent the OpenAPI v3
[dependencies]
serde = {version = "1.0", features = ["derive"]}
serde_json = "1.0"
indexmap = {version = "1.0", features = ["serde-1"]}
indexmap = {version = ">=1.6.1, <3.0.0", features = ["serde"]}

[dev-dependencies]
newline-converter = "0.2.0"
serde_yaml = "0.8"
newline-converter = "0.3.0"
serde_yaml = "0.9"

[features]
skip_serializing_defaults = []
53 changes: 26 additions & 27 deletions fixtures/petstore-discriminated.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
---
openapi: 3.0.0
info:
title: Swagger Petstore
Expand All @@ -7,39 +6,39 @@ info:
version: 1.0.0
x-hash: abc123
servers:
- url: "http://petstore.swagger.io/v1"
- url: http://petstore.swagger.io/v1
paths: {}
components:
schemas:
Cat:
description: A representation of a cat
allOf:
- $ref: "#/components/schemas/Pet"
- type: object
properties:
huntingSkill:
description: The measured skill for hunting
type: string
enum:
- clueless
- lazy
- adventurous
- aggressive
required:
- huntingSkill
- $ref: '#/components/schemas/Pet'
- type: object
properties:
huntingSkill:
description: The measured skill for hunting
type: string
enum:
- clueless
- lazy
- adventurous
- aggressive
required:
- huntingSkill
Dog:
description: A representation of a dog
allOf:
- $ref: "#/components/schemas/Pet"
- type: object
properties:
packSize:
description: the size of the pack the dog is from
type: integer
format: int32
minimum: 0
required:
- packSize
- $ref: '#/components/schemas/Pet'
- type: object
properties:
packSize:
description: the size of the pack the dog is from
type: integer
format: int32
minimum: 0
required:
- packSize
Pet:
discriminator:
propertyName: petType
Expand All @@ -50,5 +49,5 @@ components:
petType:
type: string
required:
- name
- petType
- name
- petType
9 changes: 8 additions & 1 deletion src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub enum Type {
Integer(IntegerType),
Object(ObjectType),
Array(ArrayType),
Boolean {},
Boolean(BooleanType),
}

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
Expand Down Expand Up @@ -214,6 +214,13 @@ pub struct ArrayType {
pub unique_items: bool,
}

#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct BooleanType {
#[serde(rename = "enum", default, skip_serializing_if = "Vec::is_empty")]
pub enumeration: Vec<Option<bool>>,
}

#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "lowercase")]
pub enum NumberFormat {
Expand Down

0 comments on commit b425e5c

Please sign in to comment.