fix: request variable version syncing bug (#3889)
Co-authored-by: jamesgeorge007 <jamesgeorge998001@gmail.com>
This commit is contained in:
@@ -52,8 +52,6 @@ export function makeCollection(x: Omit<HoppCollection, "v">): HoppCollection {
|
||||
* @returns The proper new collection format
|
||||
*/
|
||||
export function translateToNewRESTCollection(x: any): HoppCollection {
|
||||
if (x.v && x.v === CollectionSchemaVersion) return x
|
||||
|
||||
// Legacy
|
||||
const name = x.name ?? "Untitled"
|
||||
const folders = (x.folders ?? []).map(translateToNewRESTCollection)
|
||||
@@ -81,8 +79,6 @@ export function translateToNewRESTCollection(x: any): HoppCollection {
|
||||
* @returns The proper new collection format
|
||||
*/
|
||||
export function translateToNewGQLCollection(x: any): HoppCollection {
|
||||
if (x.v && x.v === CollectionSchemaVersion) return x
|
||||
|
||||
// Legacy
|
||||
const name = x.name ?? "Untitled"
|
||||
const folders = (x.folders ?? []).map(translateToNewGQLCollection)
|
||||
|
||||
@@ -18,22 +18,8 @@ export const HoppRESTRequestVariables = z.array(
|
||||
|
||||
export type HoppRESTRequestVariables = z.infer<typeof HoppRESTRequestVariables>
|
||||
|
||||
const V2_SCHEMA = z.object({
|
||||
const V2_SCHEMA = V1_SCHEMA.extend({
|
||||
v: z.literal("2"),
|
||||
id: z.optional(z.string()), // Firebase Firestore ID
|
||||
|
||||
name: z.string(),
|
||||
method: z.string(),
|
||||
endpoint: z.string(),
|
||||
params: HoppRESTParams,
|
||||
headers: HoppRESTHeaders,
|
||||
preRequestScript: z.string().catch(""),
|
||||
testScript: z.string().catch(""),
|
||||
|
||||
auth: HoppRESTAuth,
|
||||
|
||||
body: HoppRESTReqBody,
|
||||
|
||||
requestVariables: HoppRESTRequestVariables,
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user