fix: parsing dates from insomnia (#7003)

js-yaml uses DEFAULT_SCHEMA by default and implicitly casts date-like strings to Date (timestamp). This caused unexpected config values where dates were supposed to remain plain strings.

Switched YAML parsing to JSON_SCHEMA to disable timestamp resolution and keep date-like values as strings.
This commit is contained in:
Evgeniy
2026-02-17 16:08:40 +03:00
committed by GitHub
parent d8367e28ad
commit 540bb706e5
2 changed files with 12 additions and 2 deletions

View File

@@ -301,7 +301,7 @@ const parseInsomniaCollection = (data) => {
export const insomniaToBruno = (insomniaCollection) => {
try {
if (typeof insomniaCollection !== 'object') {
insomniaCollection = jsyaml.load(insomniaCollection);
insomniaCollection = jsyaml.load(insomniaCollection, { schema: jsyaml.JSON_SCHEMA });
}
let collection;
if (isInsomniaV5Export(insomniaCollection)) {

View File

@@ -33,6 +33,9 @@ collection:
isPrivate: false
sortKey: -1744194421965
method: GET
parameters:
- name: date
value: 2022-10-28
settings:
renderRequestBody: true
encodeUrl: true
@@ -127,7 +130,14 @@ const expectedOutput = {
},
headers: [],
method: 'GET',
params: [],
params: [
{
enabled: true,
name: 'date',
type: 'query',
value: '2022-10-28'
}
],
url: 'https://testbench-sanity.usebruno.com/ping'
},
seq: 1,