{"version":3,"file":"query-param-styles.mjs","sources":["../../../src/assemblers/document/query-param-styles.ts"],"sourcesContent":["import type { OpenAPIV3_1 } from 'openapi-types';\n\n/**\n * Query params whose values are open-ended records parsed from bracket notation\n * (e.g. filters[title][$eq]=hello). These are described as deepObject in OpenAPI\n * rather than expanded into fixed sub-keys.\n */\nexport const DEEP_OBJECT_QUERY_PARAMS = new Set(['filters']);\n\nexport const shouldUseDeepObjectStyle = (\n  name: string,\n  schema: OpenAPIV3_1.SchemaObject\n): boolean => {\n  if (DEEP_OBJECT_QUERY_PARAMS.has(name)) {\n    return true;\n  }\n\n  return (\n    schema.type === 'object' &&\n    (!schema.properties || Object.keys(schema.properties).length === 0) &&\n    schema.additionalProperties !== undefined &&\n    schema.additionalProperties !== false\n  );\n};\n\nexport const hasExpandableObjectProperties = (schema: OpenAPIV3_1.SchemaObject): boolean => {\n  return Boolean(\n    schema.type === 'object' && schema.properties && Object.keys(schema.properties).length > 0\n  );\n};\n"],"names":["DEEP_OBJECT_QUERY_PARAMS","Set","shouldUseDeepObjectStyle","name","schema","has","type","properties","Object","keys","length","additionalProperties","undefined","hasExpandableObjectProperties","Boolean"],"mappings":"AAEA;;;;AAIC,IACM,MAAMA,wBAAAA,GAA2B,IAAIC,GAAAA,CAAI;AAAC,IAAA;CAAU;AAEpD,MAAMC,wBAAAA,GAA2B,CACtCC,IAAAA,EACAC,MAAAA,GAAAA;IAEA,IAAIJ,wBAAAA,CAAyBK,GAAG,CAACF,IAAAA,CAAAA,EAAO;QACtC,OAAO,IAAA;AACT,IAAA;IAEA,OACEC,MAAAA,CAAOE,IAAI,KAAK,QAAA,KACf,CAACF,MAAAA,CAAOG,UAAU,IAAIC,MAAAA,CAAOC,IAAI,CAACL,OAAOG,UAAU,CAAA,CAAEG,MAAM,KAAK,CAAA,CAAA,IACjEN,MAAAA,CAAOO,oBAAoB,KAAKC,SAAAA,IAChCR,MAAAA,CAAOO,oBAAoB,KAAK,KAAA;AAEpC;AAEO,MAAME,gCAAgC,CAACT,MAAAA,GAAAA;AAC5C,IAAA,OAAOU,OAAAA,CACLV,MAAAA,CAAOE,IAAI,KAAK,YAAYF,MAAAA,CAAOG,UAAU,IAAIC,MAAAA,CAAOC,IAAI,CAACL,MAAAA,CAAOG,UAAU,CAAA,CAAEG,MAAM,GAAG,CAAA,CAAA;AAE7F;;;;"}