Using openapi-diff via API
I was trying to use openapi-diff API but it seems that it requires swagger specification to be in a file, even though there is SpecOption.content
option:
const diff = await diffSpecs({
destinationSpec: {content: newspec, format: 'swagger2', location: ''},
sourceSpec: {content: oldspec, format: 'swagger2', location: ''},
});
I wonder whether you have any plans to support this.
Comments (5)
-
reporter -
reporter it looks like I misunderstood openapi-diff report
-
The api does already accept the swagger content directly as you are expecting. One thing that might be tripping you up is that ‘SpecOption.content’ should be a string containing serialised json or yaml content, not an object. This is the full type definition for the api incase you haven’t found it yet:
https://bitbucket.org/atlassian/openapi-diff/src/master/lib/api-types.d.ts
If you continue to have trouble please let me know and I’ll try and help you work it out. If you can include details on what you are passing as input, what output you get and what output you were expecting that will help me better understand your issue.
If you have any feedback on the api feel free to let me know about that too. This api was introduced to solve a specific use case my team had, but we are open to evolving the api to support more use cases.
-
reporter Thanks, Ben.
-
reporter - changed status to resolved
- Log in to comment
I could submit a PR if this is worth implementing.