diff --git a/src/lib/components/atoms/ExampleInput.svelte b/src/lib/components/atoms/ExampleInput.svelte index 4b9c1cb..971abcd 100644 --- a/src/lib/components/atoms/ExampleInput.svelte +++ b/src/lib/components/atoms/ExampleInput.svelte @@ -3,12 +3,39 @@ import { SlideToggle } from '@skeletonlabs/skeleton'; export let example: OpenAPIV3.ExampleObject; - export let name: string; + export let name: string = ''; + + let exampleValue = example.value; + let external = false; + + // initialize the component + (() => { + if ( + 'value'! in example && + 'externalValue' in example && + example.externalValue !== ('' || undefined) + ) { + external = true; + return; + } + external = false; + })(); + + $: { + // make sure the exampleValue is a JSON-compatible string + try { + JSON.parse(exampleValue); + } catch (e) { + exampleValue = JSON.stringify(exampleValue); + } + // apply the changes to the example object + example.value = exampleValue; + } let schema = false; -
{name}
{#if schema} @@ -18,19 +45,45 @@ {:else} - - +Location:
- - + $: () => { + if (isReference) return; + if (parameter.style == 'form') { + parameter.explode = true; + } else { + parameter.explode = false; + } + }; + + // TODO: maybe needs validation for query-deepObject + const styleOptions = [ + { + style: 'matrix', + description: 'Matrix', + validFor: ['path'] + }, + { + style: 'label', + description: 'Label', + validFor: ['path'] + }, + { + style: 'form', + description: 'Form', + validFor: ['query', 'cookie'] + }, + { + style: 'simple', + description: 'Simple', + validFor: ['header', 'path'] + }, + { + style: 'spaceDelimited', + description: 'Space Delimited', + validFor: ['query'] + }, + { + style: 'pipeDelimited', + description: 'Pipe Delimited', + validFor: ['query'] + }, + { + style: 'deepObject', + description: 'Deep Object', + validFor: ['query'] + } + ]; + - -Examples
- {#each Object.keys(value.examples) as example} -|
-
-
- {variable} - |
- - - | -- - | -
-
- |
+
+ |
+
+
+
+ |
+
Route Information
+Summary
+ +Description
+ +Servers
+ {#if editedPath.servers} + {#each editedPath.servers as server, i} +Parameters
+ {#if editedPath.parameters} + {#each editedPath.parameters as parameter, i} +This parameter is a reference
+ {:else} +Summary
- -Description
- -Here you can add custom servers for this specific call.
- {#if tempPath.servers && tempPath.servers.length > 0} - {#each tempPath.servers as server, index} -Server {index + 1}
- -- Here you can add operations for this path. Select only the operations you want to support -
- -
+{JSON.stringify(data, null, 2)}
+
+ edited:
+
+{JSON.stringify(editedPath, null, 2)}
+