Closed vampyar closed 2 months ago
@vampyar Can you share the openapi file? So we can use that for our investigation to reproduce the behaviour?
Open API api-json.json
oas-format-filter.yml
---
methods:
tags:
operationIds:
####################################################################
# With this filters run only /v1/systems endpoints
# if you need only one specific endpoints uncomment all lines below
####################################################################
operations:
# - "*::/v1/vehicle-types*"
# - "*::/v2/regulations*"
# - "*::/v1/regulations*"
# - "*::/v1/systems*"
- "*::/v2/vehicle-types*"
- "*::/v2/systems*"
- "*::/v1/releases*"
- "*::/v2/releases*"
- "*::/v1/ecus*"
- "*::/v2/ecus*"
- "*::/v1/status*"
- "*::/v2/status*"
### END ####
- "*::/v1/packages*"
- "*::/v2/packages*"
- "*::/v1/vehicles*"
- "*::/v2/vehicles*"
- "*::/v1/uploader/*"
- "*::/v2/uploader/*"
- "*::/v1/versions/list*"
- "*::/v2/versions/list*"
- "*::/v1/associations/manage*"
- "*::/v2/associations/manage*"
- "*::/v1/packageDistribution*"
- "*::/v2/packageDistribution*"
- "*::/v1/updateVehicleInfo*"
- "*::/v2/updateVehicleInfo*"
flags: []
flagValues: []
portman-cli-options.yml
url: http://localhost:3000/api-json
baseUrl: http://localhost:3000
output: "./tests/portman/sums.postman.json"
collectionName: "SUMS NewMan / Portman"
portmanConfigFile: "./tests/portman/portman-config.crm.yml"
postmanConfigFile: "./tests/portman/postman-config.crm.json"
filterFile: "./tests/portman/oas-format-filter.yml"
includeTests: true
syncPostman: false # FIXME Temporary commented
runNewman: true
newmanRunOptions:
reporters:
- cli
- junit
reporter:
junit:
export: "junit-postman.xml"
reporter-junit-export: "junit-postman.xml"
portman-config.crm.yml
version: 1
globals:
# For every request generated omit the Postman examples
# This helps keep the generated test collection leaner
stripResponseExamples: true
variableCasing: camelCase
keyValueReplacements:
# it's param tack automatic from env by prefix 'PORTMAN_' => PORTMAN_ADDITIONAL_TOKEN_USER
additionaltokenuser: "{{additionalTokenUser}}"
orderOfOperations:
- "*::/v1/regulations"
- "*::/v1/vehicle-types"
- "*::/v1/system"
tests:
contractTests:
- openApiOperation: "*::*"
# Check that the API returned a 2XX response
statusSuccess:
enabled: true
# FIXME
# responseTime:
# enabled: true
# maxMs: 300
# Check if the response contains a Content-Type header with application/json
contentType:
enabled: true
# Check if the response contaisn a JSON response body
jsonBody:
enabled: true
# contentTests:
# $ref: './tests/portman/definitions/overwrites-vehicle-types.yml#/contentTests'
assignVariables:
- openApiOperation: "POST::*"
collectionVariables:
- responseBodyProp: data._id
name: "<operationId>Id"
- responseBodyProp: data.name
name: "<operationId>Name"
- openApiOperation: "PUT::*"
collectionVariables:
- responseBodyProp: data._id
name: "<operationId>IdUpdated"
- responseBodyProp: data.name
name: "<operationId>NameUpdated"
#overwrites:
# $ref: './tests/portman/definitions/overwrites.yml#/overwrites'
@thim81 Hi, do you have any updates about it issues ?
I did start investigating it but did not yet came to the cause of it.
Due to vacation, away from a laptop, I ll continue the investigation again past mid August.
@thim81 Oh, sorry, have a good holiday, I hear you.
@thim81 Do you have any updates ?
hi @vampyar
No news about the cause, but are able to reproduce it:
Without ordering:
With ordering:
If I understand correctly, you want to order the "folders"?
from:
to:
The ordering is build for the ordering of the operations within the folders, it will not re-arrange the folders, but that is what you are looking for?
As are 2 work-arounds, you could use
npx openapi-format openapi.json -o openapi-formatted.json --sortFile oaf-sort.json --filterFile oaf-filter.json
where the oaf-sort.json looks like this:
{
"sortPathsBy": "tags"
}
oaf-filter.json:
---
methods: []
tags: []
operationIds: []
####################################################################
# With this filters run only /v1/systems endpoints
# if you need only one specific endpoints uncomment all lines below
####################################################################
operations:
# - "*::/v1/vehicle-types*"
# - "*::/v2/regulations*"
# - "*::/v1/regulations*"
# - "*::/v1/systems*"
- "*::/v2/vehicle-types*"
- "*::/v2/systems*"
- "*::/v1/releases*"
- "*::/v2/releases*"
- "*::/v1/ecus*"
- "*::/v2/ecus*"
- "*::/v1/status*"
- "*::/v2/status*"
### END ####
- "*::/v1/packages*"
- "*::/v2/packages*"
- "*::/v1/vehicles*"
- "*::/v2/vehicles*"
- "*::/v1/uploader/*"
- "*::/v2/uploader/*"
- "*::/v1/versions/list*"
- "*::/v2/versions/list*"
- "*::/v1/associations/manage*"
- "*::/v2/associations/manage*"
- "*::/v1/packageDistribution*"
- "*::/v2/packageDistribution*"
- "*::/v1/updateVehicleInfo*"
- "*::/v2/updateVehicleInfo*"
flags: []
flagValues: []
See playground for the result
This will give you a filtered and sorted openapi-formatted.json file, which you can pass along to Portman which will result in:
This is off course not a permanent fix, since it will sort the folders by alphabet and not any specific custom ordering.
To provide a more permanent solution, we would have to introduce a new feature "orderOfFolders" (instead of "orderOfOperations").
@vampyar We created a PR to introduce the option to sort Postman folders based on the "orderOfFolders" configuration. See the PR for more details.
@thim81 Thx mate) Coooool )
hi @vampyar
We just release Portman v1.30, which includes the "orderOfFolders" option to sort Postman folders. Be sure to update to the latest version of Portman.
hi @thim81 can you help with it ?
I have this entities by by default when I'm running portman it run first entity in the the list, how I can did it without sorting in the openapi
because I did try use config, but it not helped me, it's sorted only methods: