Skip to content

Ensure same-level properties and allOf are rendered #904

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions demo/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ const config: Config = {
label: "Petstore (versioned)",
to: "/category/petstore-versioned-api",
},
{
label: "Tests",
to: "/category/tests",
},
],
},
{
Expand Down Expand Up @@ -268,6 +272,16 @@ const config: Config = {
},
showSchemas: true,
} satisfies OpenApiPlugin.Options,
tests: {
specPath: "examples/tests",
outputDir: "docs/tests",
sidebarOptions: {
groupPathsBy: "tag",
categoryLinkSource: "info",
},
hideSendButton: true,
showSchemas: true,
} satisfies OpenApiPlugin.Options,
} satisfies Plugin.PluginOptions,
},
],
Expand Down
282 changes: 282 additions & 0 deletions demo/examples/tests/allOf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,282 @@
openapi: 3.0.1
info:
title: AllOf Variations API
description: Demonstrates various allOf schema combinations.
version: 1.0.0
tags:
- name: allOf
description: allOf tests
paths:
/multiple-allof-nested:
get:
tags:
- allOf
summary: Multiple allOf with Nested Properties
description: |
Schema:
```yaml
allOf:
- type: object
properties:
outerProp1:
type: object
properties:
innerProp1:
type: string
- type: object
properties:
outerProp2:
type: object
properties:
innerProp2:
type: number
```
responses:
"200":
description: Successful response
content:
application/json:
schema:
allOf:
- type: object
properties:
outerProp1:
type: object
properties:
innerProp1:
type: string
- type: object
properties:
outerProp2:
type: object
properties:
innerProp2:
type: number

/allof-shared-required:
get:
tags:
- allOf
summary: allOf with Shared Required Properties
description: |
Schema:
```yaml
allOf:
- type: object
properties:
sharedProp:
type: string
required: [sharedProp]
- type: object
properties:
anotherProp:
type: number
required: [anotherProp]
```
responses:
"200":
description: Successful response
content:
application/json:
schema:
allOf:
- type: object
properties:
sharedProp:
type: string
required: [sharedProp]
- type: object
properties:
anotherProp:
type: number
required: [anotherProp]

# /allof-conflicting-properties:
# get:
# tags:
# - allOf
# summary: allOf with Conflicting Properties
# description: |
# Schema:
# ```yaml
# allOf:
# - type: object
# properties:
# conflictingProp:
# type: string
# - type: object
# properties:
# conflictingProp:
# type: number
# ```
# responses:
# '200':
# description: Successful response
# content:
# application/json:
# schema:
# allOf:
# - type: object
# properties:
# conflictingProp:
# type: string
# - type: object
# properties:
# conflictingProp:
# type: number

# /allof-mixed-data-types:
# get:
# tags:
# - allOf
# summary: allOf with Mixed Data Types
# description: |
# Schema:
# ```yaml
# allOf:
# - type: object
# properties:
# mixedTypeProp1:
# type: string
# - type: array
# items:
# type: number
# ```
# responses:
# '200':
# description: Successful response
# content:
# application/json:
# schema:
# allOf:
# - type: object
# properties:
# mixedTypeProp1:
# type: string
# - type: array
# items:
# type: number

/allof-deep-merging:
get:
tags:
- allOf
summary: allOf with Deep Merging
description: |
Schema:
```yaml
allOf:
- type: object
properties:
deepProp:
type: object
properties:
innerProp1:
type: string
- type: object
properties:
deepProp:
type: object
properties:
innerProp2:
type: number
```
responses:
"200":
description: Successful response
content:
application/json:
schema:
allOf:
- type: object
properties:
deepProp:
type: object
properties:
innerProp1:
type: string
- type: object
properties:
deepProp:
type: object
properties:
innerProp2:
type: number

# /allof-discriminator:
# get:
# tags:
# - allOf
# summary: allOf with Discriminator
# description: |
# Schema:
# ```yaml
# allOf:
# - type: object
# discriminator:
# propertyName: type
# properties:
# type:
# type: string
# - type: object
# properties:
# specificProp:
# type: string
# ```
# responses:
# "200":
# description: Successful response
# content:
# application/json:
# schema:
# allOf:
# - type: object
# discriminator:
# propertyName: type
# properties:
# type:
# type: string
# - type: object
# properties:
# specificProp:
# type: string

/allof-same-level-properties:
get:
tags:
- allOf
summary: allOf with Same-Level Properties
description: |
Schema:
```yaml
allOf:
- type: object
properties:
allOfProp1:
type: string
allOfProp2:
type: string
properties:
parentProp1:
type: string
parentProp2:
type: string
```
responses:
"200":
description: Successful response
content:
application/json:
schema:
allOf:
- type: object
properties:
allOfProp1:
type: string
allOfProp2:
type: string
properties:
parentProp1:
type: string
parentProp2:
type: string
14 changes: 14 additions & 0 deletions demo/sidebars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,20 @@ const sidebars: SidebarsConfig = {
items: petstoreVersionSidebar,
},
],

tests: [
{
type: "category",
label: "Tests",
link: {
type: "generated-index",
title: "Tests",
description: "Various OpenAPI test cases",
slug: "/category/tests",
},
items: require("./docs/tests/sidebar.js"),
},
],
};

export default sidebars;
Loading
Loading