Paw-SwaggerImporter
Paw-SwaggerImporter copied to clipboard
schema reference not expanded for request body
Trying to import this swagger definition https://gist.github.com/databus23/848f60539956284e504605d4d9c01bc1
I noticed that the JSF contains this:
Same here. Update on this?
@sirago @databus23 If you go in your environment, you'll see that all the swagger definitions are saved there. Unfortunately, there are currently limitations in Paw wrt. to what you can do with JSON objects and unfortunately expanding linked objects inside a JSON is not possible atm. I would love to be able to do something like this:
{
"$ref": "#/definitions/Cluster",
"definitions": {
"Cluster": EnvironmentVariable<swagger_definitions.Cluster>
}
}
But that does not handle the JSON object correctly 😢
The reason we don't directly expand the definitions is that they are shared across multiple requests/objects, and we'd lose this shared aspect by inserting the corresponding references inside the JSF DVs. This would make it extremely brittle in case of changes of the model, as this would basically mean that you'd have to change every single JSF field manually, which is extremely error-prone. I preferred to just have a link that says "here's where the schema is" rather than having a potentially stale schema that could induce bugs (especially since JSF is an rng generation lib, and those are hell to debug).
I know the solution isn't great, but if someday Paw has improved support for JSON objects, I'll update the library to make this awesome.
Hi Jonathan, so picking up on this issue from the other thread too, you mentioned
I know the solution isn't great
which solution exactly ?
If is the tool is not supporting this essential situation, i'd like to know what would be a workflow to work with a swagger that's referencing json schema externally please ?
Many thanks,
@mshahat Sorry if I was unclear, I was talking about the current implementation of the swagger schema storage inside of Paw, which isn't a great solution to the problem of linked swagger schemas, but the best currently available.
Otherwise, it's not possible at the moment to reference json schemas from within json schemas.
The only currently possible solution is to have no $ref
in your schemas. If you don't have any then, you can store your json schemas inside environment variables as JSON Dynamic Values, and the references them from your request variables or body.
Very unfortunate. This is a deal breaker for many developers. There is also an issue like this in Postman which made me evaluate Paw hoping it would work better but now we have to move to some other software.