question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I can’t find a firm declaration on this, but I can see it in SwaggerUI, so my question is, is this considered a valid supported way to define that a field in object1 relates to a field in object2.

To say that the photo::album_id field, relates to the album::id field.

So generated code can automatically organize multiple lists of objects.

"definitions": {
	"photo": {
		"type": "object",
		"properties": {
			"id":		{ "type": "integer" },
			"album_id":	{ "$ref": "#/definitions/album/properties/id" }
		},
	},
	"album": {
		"type": "object",
		"properties": {
			"id": { "type": "integer" }
		},
	},
},

If this is valid, or some other way is valid; can an a usage please be added to the examples?

And if not valid then can this or something similar be added?

thanks

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:23 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
silkentrancecommented, Aug 3, 2018

@gareth-ib you do not design your APIs this way, there is no notion of a foreign key reference. Just make it also an integer and keep in mind that it is actually a reference to an instance of type album.

1reaction
gareth-ibcommented, Aug 3, 2018

@silkentrance But data always has the concept of related data. So an API with lots of different objects being passed through it will have a myriad of relational concepts. country, state, city, address, member, profile, anything… So ideally there would be a way to document and generate handlers for that instead of the client programmers needing to learn all the relations that exist in an entire API system. Example a list of 50 profiles, all with a country_id, and separately a unique list of their countries as full objects, which ends up being 2 instances of the country object. As opposed to a client project needing to pre-hard-code relations between objects

Read more comments on GitHub >

github_iconTop Results From Across the Web

Field References - KeePass Password Safe
Note that field references are intended for referencing data stored in different entries. If you want to insert data from the same/current entry,...
Read more >
ESQL field references overview - IBM
An ESQL field reference is a sequence of period-separated values that identify a specific field (which might be a structure) within a ...
Read more >
Reference Fields - Catalytic Help Center
You can insert references to fields in places like instructions, the body of an email, and when configuring actions. These field references dynamically ......
Read more >
Using Field References - Ivanti
The simplest field reference is a field name. To reference a field within the current business object, refer to the name of the...
Read more >
Field References Deep Dive | Logstash Reference [master]
It is often useful to be able to refer to a field or collection of fields by name. To do this, you can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found