Reusable object properties?
See original GitHub issueHi everyone,
I think Swagger UI is a great tool - thanks for making it!
I particularly like the fact that you can reuse definitions, parameters and responses to make the YAML code more modular and was wondering if there’s any way to do the same for object properties? Some of my object properties are the same as parameters I’ve defined elsewhere and it would great if I could use a single reference for both.
Is there any way of doing something like this?
paths:
/pet:
get:
tags:
- "pet"
summary: "Add a new pet to the store"
description: ""
produces:
- application/json
parameters:
- $ref: "#/parameters/id"
responses:
405:
description: "Invalid input"
200:
schema:
title: Pet
type: object
required: [id, name]
properties:
$ref: "#/parameters/id" # Doesn't work :(
name:
type: string
description: The new pet's name.
parameters:
id:
name: id
in: path
type: integer
required: true
description: The ID.
Issue Analytics
- State:
- Created 6 years ago
- Comments:14 (7 by maintainers)
Top Results From Across the Web
What are Javascript Objects? Containers for Reusable ...
Javascript objects are containers for properties and behaviors that are reusable, allowing developers to provide complex functionality with ...
Read more >Reusable Objects - Web Central
JavaScript API Reference/Creating Custom Java Script Objects. Reusable Objects ... if you create many object, or if the objects have many properties.
Read more >Adding and reusing properties - IBM
Reused properties are properties that have been defined in a solution that has been deployed. Reused properties can be used again in other...
Read more >Creating a reusable object from the object library
Creating a reusable object from the object library · Right-click the new object in the object library and select Properties. The Properties dialog...
Read more >How to Build a Reusable Object in Javascript for HTML5 and ...
What if you want to build several objects in Javascript with the same definition? JavaScript supports an idea called a constructor, which allows ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Not OOTB. At some point we plan on introducing a way to hide all models, but not some. You can always write your own plugin to support any behavior you want.
Hi webron,
In your example, “id” will appear in the Models. Is there a way to prevent that? Or some other way to make a reusable “object” that is not exposed in the UI?
Thanks!