Skip to content
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

oaOutput in NPX call doesn't write file #278

Closed
ChristineP2 opened this issue Mar 12, 2022 · 9 comments
Closed

oaOutput in NPX call doesn't write file #278

ChristineP2 opened this issue Mar 12, 2022 · 9 comments
Assignees
Labels
question Further information is requested

Comments

@ChristineP2
Copy link

I attempted to generate an output and an oaOutput file together using npx using Gradle. The CLI output indicated the oaOutput file wrote to tmp even though I ensured the filepath existed prior to running the command.

I will say I find it is just as easy to chain a gradle task for OpenAPI-format with the Portman task. I wonder if it might make sense to avoid embedding it, unless it is needed for other purposes.

My current plan is to create the various test sets from my main spec using openAPI-format, then process that through portman to generate the postman collection(s).

@thim81
Copy link
Collaborator

thim81 commented Mar 12, 2022

Hi @ChristineP2

Could you share which parameters you were using? So we can reproduce the issue.

@thim81
Copy link
Collaborator

thim81 commented Mar 12, 2022

We integrated OpenApi-format to facilitate easy filtering capabilities using a wide range of options (tags, tag values, targeting syntax (ex: POST::*)) without the need for Portman users to install an additional package.

For more complex usage scenarios, you can use OpenApi-format upfront and pass the result to Portman. We use similar chaining of OpenApi-format and Portman, where we have a huge OpenApi spec but want to test parts individually or filter out WIP endpoints from the test suite.

@ChristineP2
Copy link
Author

The chain is what I ended up doing as well. I loved the initial filtering capability, but there's even more I can do with the full library. Overall I'm thrilled with these 2 libraries, they make OAS the functional and time saving spec I expected it to be. Without these tools, it makes keeping the OAS3 file up to date a chore instead of a needed tool. I am so happy to have these.

I'm going to work on getting a POC together and see if I can find root cause on the underlying issue.

@thim81
Copy link
Collaborator

thim81 commented Mar 14, 2022

hi @ChristineP2

Very happen to hear, that you have found a flow that works for you.

I have created a blog post that describes the "spec-driven" approach and talked about it in a podcast.

This is how my flow looks like, which off course is heavily based on OAS, OpenAPI-format & Portman.

image

@thim81
Copy link
Collaborator

thim81 commented Mar 21, 2022

@ChristineP2 Do you have any news on which parameters you were using, so we can reproduce the issue?

@thim81 thim81 self-assigned this Mar 21, 2022
@thim81 thim81 added the question Further information is requested label Mar 21, 2022
@ChristineP2
Copy link
Author

@thim81 Sorry for the delay. I put this branch together that will hopefully allow you to see what I'm seeing: https://github.com/ChristineP2/swagger-petstore/tree/portman

I believe it will demonstrate 2 issues:

  1. oaOutput doesn’t seem to save the filter (most visible when not saving the postman collection)
  2. The command errs if you don’t create the directories yourself prior to running the cli.

The command with the collection and filter is npx @apideck/portman --local src/main/resources/openapi.yaml --collectionName test-save-filter --filterFile filterby.json --oaOutput src/gen/portman/openapi-filtered.yaml --output src/gen/portman/testCollection.json

The command with just the filter output is where I saw the tmp location: npx @apideck/portman --local src/main/resources/openapi.yaml --collectionName test-save-filter --filterFile filterby.json --oaOutput src/gen/portman/openapi-filtered.yaml

You can also run the following gradle tasks:

./gradlew testPortmanFilterOnly - This results in the output with the .tmp file listed and no files created.

./gradlew testPortman - This results in the collection displaying, but no filter file added.

./gradlew testPortmanNoDir - This results in a hard error as the directories haven’t been created

@thim81
Copy link
Collaborator

thim81 commented Mar 25, 2022

@ChristineP2 What is the location/path from which you run the command?

npx @apideck/portman --local src/main/resources/openapi.yaml --collectionName test-save-filter --filterFile filterby.json --oaOutput src/gen/portman/openapi-filtered.yaml --output src/gen/portman/testCollection.json

Do you run it from from the content root or from src/main/resources/? Because Portman threats all input files as relative from where the command is initiated.

I'll investigate if Portman will create the folder for oaOutput, since that might be a bug.

@thim81
Copy link
Collaborator

thim81 commented Mar 28, 2022

@ChristineP2 We just released version 1.15.0 of Portman, where the reported issues should be fixed.

@thim81
Copy link
Collaborator

thim81 commented Mar 28, 2022

Closing this issue. If you still have problems, feel free to re-open or create a new issue.

@thim81 thim81 closed this as completed Mar 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants