-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Extending Data Structures #284
Comments
This should be possible. Seems like problem is with the Note However I believe we are having a bug here in our implementation cc @pksunkara |
You are correct, drafter now approves the markdown using the following example: FORMAT: 1A
HOST: https://test.api.com/
# Test API
Hi, welcome to the API!
# Group Projects
Wow, we are using projects!
### Retrieve single project [GET /projects/{id}]
+ Parameters
+ id: `5` (string, required)
+ Response 200 (application/json)
+ Attributes (object)
+ data (Project1Get, required)
# Data Structures
## ProjectLink (object)
+ self: `https://test.api.com/projects/5` (string, required)
## ProjectIdentifier (object)
+ type: `projects` (string, required)
+ id: `5` (string, required)
## Project1Get (ProjectIdentifier)
+ attributes (object, required)
+ number: `PRO-5` (string) - A readable identifier for employees to refer to projects.
+ links (ProjectLink, required)
Edit: whoops, I see apiaryio is rendering it correct! But it places the type/id at the bottom in this case. My preference would be placing it at the top. I'll wait before refactoring my docs again ;-) |
@robbinjanssen If you want them to be at the top, please do something like this: ## Project1Get
+ Include ProjectIdentifier
+ attributes (object, required)
+ number: `PRO-5` (string) - A readable identifier for employees to refer to projects.
+ links (ProjectLink, required) |
@pksunkara cool thanks! |
A simple example of the bug is as follows: # GET /projects
+ Response 200 (application/json)
+ Attributes (object)
+ data (B_B, required)
# Data Structures
## A_A
+ a: a
## B_B (A_A)
+ b: b |
@zdne I think this is related to apiaryio/snowcrash#335. What do you say? |
Hi, I've got a question/proposal about data structures. Maybe this is more MSON related but I'll start here. To keep data structures nice and tidy, i'd like as little duplicate data as possible, therefor it would be nice if data structures could extend each other.
Assume the following data structure:
In the
links
attribute ofProject1_Get
I re-use theProject_Link
object which works great. But suppose I need the following DataStructure as well:Now there is duplicate data in my data structures because the
Project1_Identifier
contains thetype
andid
attribute, but also theProject1_Get
contains it. It would be great if I could do the following:In the following example drafter returns errors:
The text was updated successfully, but these errors were encountered: