Skip to content

Commit

Permalink
init postman collection definition with raw fern postman collection (#15
Browse files Browse the repository at this point in the history
)
  • Loading branch information
dsinghvi authored Nov 8, 2022
1 parent d268d9e commit 16e0179
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
8 changes: 4 additions & 4 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

12 changes: 5 additions & 7 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@ async function run(): Promise<void> {

const rawPostmanCollection = JSON.parse(
(await readFile(postmanCollectionPath)).toString()
);
) as PostmanParsing.PostmanCollectionSchema.Raw;
const postmanCollection =
PostmanParsing.PostmanCollectionSchema.parse(rawPostmanCollection);
core.info(
`Read collection ${postmanCollection.info.name} from ${postmanCollectionPath}.`
);
core.info(`Read collection from ${postmanCollectionPath}.`);

const postmanClient = new FernPostmanClient({
auth: {
Expand Down Expand Up @@ -57,15 +55,15 @@ async function run(): Promise<void> {
collectionMetadataItem.name === postmanCollection.info.name
);
const collectionDefinition: CollectionDefinition = {
...postmanCollection,
...rawPostmanCollection,
auth:
postmanCollection.auth != null
? postmanCollection.auth._visit({
basic: () => {
return { ...postmanCollection.auth };
return { ...rawPostmanCollection.auth };
},
bearer: () => {
return { ...postmanCollection.auth };
return { ...rawPostmanCollection.auth };
},
_other: () => undefined,
})
Expand Down

0 comments on commit 16e0179

Please sign in to comment.