diff --git a/.gitignore b/.gitignore
index 6635cf5..6fa1a25 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,3 +8,5 @@ node_modules
!.env.example
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
+
+.vercel
diff --git a/src/lib/authTemplates.ts b/src/lib/authTemplates.ts
new file mode 100644
index 0000000..e839010
--- /dev/null
+++ b/src/lib/authTemplates.ts
@@ -0,0 +1,71 @@
+import type {
+ ApiKeyAuth,
+ BasicAuth,
+ BearerAuth,
+ CookieAuth,
+ OAuth2Auth,
+ OpenIdConnectAuth
+} from './types/auth';
+
+export const basicAuthTemplate: BasicAuth = {
+ identifier: '',
+ type: 'http',
+ scheme: 'basic'
+};
+
+export const bearerAuthTemplate: BearerAuth = {
+ identifier: '',
+ type: 'http',
+ scheme: 'bearer',
+ bearerFormat: ''
+};
+
+export const apiKeyAuthTemplate: ApiKeyAuth = {
+ identifier: '',
+ type: 'apiKey',
+ in: 'header',
+ name: ''
+};
+
+export const openIdAuthTemplate: OpenIdConnectAuth = {
+ identifier: '',
+ type: 'openIdConnect',
+ openIdConnectUrl: ''
+};
+
+export const oauth2AuthTemplate: OAuth2Auth = {
+ identifier: '',
+ type: 'oauth2',
+ description: '',
+ flows: []
+};
+
+export const cookieAuthTemplate: CookieAuth = {
+ identifier: '',
+ type: 'apiKey',
+ in: 'cookie',
+ name: ''
+};
+
+export const oauth2FlowTemplates = {
+ authorizationCode: {
+ name: 'authorizationCode',
+ authorizationUrl: '',
+ tokenUrl: '',
+ scopes: []
+ },
+ implicit: {
+ name: 'implicit',
+ authorizationUrl: '',
+ scopes: []
+ },
+ password: {
+ name: 'password',
+ tokenUrl: '',
+ scopes: []
+ },
+ clientCredentials: {
+ name: 'clientCredentials',
+ tokenUrl: ''
+ }
+};
diff --git a/src/lib/components/atoms/AuthenticationItem.svelte b/src/lib/components/atoms/AuthenticationItem.svelte
new file mode 100644
index 0000000..bd1d717
--- /dev/null
+++ b/src/lib/components/atoms/AuthenticationItem.svelte
@@ -0,0 +1,154 @@
+
+
+
+
diff --git a/src/lib/components/atoms/OAuthFlow.svelte b/src/lib/components/atoms/OAuthFlow.svelte
new file mode 100644
index 0000000..421f78c
--- /dev/null
+++ b/src/lib/components/atoms/OAuthFlow.svelte
@@ -0,0 +1,80 @@
+
+
+
+ {#if flow.name == 'authorizationCode'}
+
Authorization Code
+
+
+
+ {:else if flow.name == 'implicit'}
+ Implicit
+
+
+ {:else if flow.name == 'password'}
+ Password
+
+
+ {:else if flow.name == 'clientCredentials'}
+ Client Credentials
+
+
+ {/if}
+
diff --git a/src/lib/components/atoms/ScopeList.svelte b/src/lib/components/atoms/ScopeList.svelte
new file mode 100644
index 0000000..7fcd26a
--- /dev/null
+++ b/src/lib/components/atoms/ScopeList.svelte
@@ -0,0 +1,58 @@
+
+
+ Scopes
+
+
+
+
+
diff --git a/src/lib/components/atoms/ServerInput.svelte b/src/lib/components/atoms/ServerInput.svelte
index 625c336..0d863fa 100644
--- a/src/lib/components/atoms/ServerInput.svelte
+++ b/src/lib/components/atoms/ServerInput.svelte
@@ -19,7 +19,7 @@
diff --git a/src/lib/components/sections/Authentication.svelte b/src/lib/components/sections/Authentication.svelte
new file mode 100644
index 0000000..4ae7bb9
--- /dev/null
+++ b/src/lib/components/sections/Authentication.svelte
@@ -0,0 +1,83 @@
+
+
+
diff --git a/src/lib/index.ts b/src/lib/index.ts
index e79094d..6ba8dff 100644
--- a/src/lib/index.ts
+++ b/src/lib/index.ts
@@ -1,9 +1,12 @@
import type { OpenAPI } from './types';
import { persisted } from 'svelte-persisted-store';
-export const openApiStore = persisted('openApi', {
+export const localStoragePrefix = 'openapigen-';
+
+export const openApiStore = persisted(`${localStoragePrefix}openApi`, {
title: '',
version: '',
description: '',
- servers: []
+ servers: [],
+ securitySchemas: []
});
diff --git a/src/lib/types.ts b/src/lib/types.ts
deleted file mode 100644
index 90cd1d0..0000000
--- a/src/lib/types.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-export interface OpenAPI extends Info {
- servers: Server[];
-}
-
-export interface Info {
- title: string;
- version: string;
- description?: string;
-}
-
-export interface Server {
- url: string;
- description?: string;
-}
diff --git a/src/lib/types/auth.ts b/src/lib/types/auth.ts
new file mode 100644
index 0000000..ccf0f3b
--- /dev/null
+++ b/src/lib/types/auth.ts
@@ -0,0 +1,81 @@
+// Basic Auth
+export interface BasicAuth extends Auth {
+ type: 'http';
+ scheme: 'basic';
+}
+
+// Bearer Token
+export interface BearerAuth extends Auth {
+ type: 'http';
+ scheme: 'bearer';
+ bearerFormat?: string; // arbitrary value for documentation purposes
+}
+
+// API Key
+export interface ApiKeyAuth extends Auth {
+ type: 'apiKey';
+ in: 'header' | 'query' | 'cookie';
+ name: string;
+}
+
+// OAuth2
+export interface OAuth2Auth extends Auth {
+ type: 'oauth2';
+ description: string;
+ flows: Flows[];
+}
+
+type Scope = [
+ {
+ scope: string;
+ description?: string;
+ }
+];
+
+export type Flows =
+ | OAuth2AuchorizationCodeFlow
+ | OAuth2ImplicitFlow
+ | OAuth2PasswordFlow
+ | OAuth2ClientCredentialsFlow;
+
+interface OAuth2AuchorizationCodeFlow {
+ name: 'authorizationCode';
+ authorizationUrl: string;
+ tokenUrl: string;
+ scopes: Scope[];
+}
+
+interface OAuth2ImplicitFlow {
+ name: 'implicit';
+ authorizationUrl: string;
+ scopes: Scope[];
+}
+
+interface OAuth2PasswordFlow {
+ name: 'password';
+ tokenUrl: string;
+ scopes: Scope[];
+}
+
+interface OAuth2ClientCredentialsFlow {
+ name: 'clientCredentials';
+ tokenUrl: string;
+ scopes: Scope[];
+}
+
+// OpenID Connect
+export interface OpenIdConnectAuth extends Auth {
+ type: 'openIdConnect';
+ openIdConnectUrl: string;
+}
+
+// Cookie Auth
+export interface CookieAuth extends Auth {
+ type: 'apiKey';
+ in: 'cookie';
+ name: string;
+}
+
+interface Auth {
+ identifier: string; // a unique name for the auth-configuration
+}
diff --git a/src/lib/types/index.ts b/src/lib/types/index.ts
new file mode 100644
index 0000000..9781bdc
--- /dev/null
+++ b/src/lib/types/index.ts
@@ -0,0 +1,32 @@
+import type {
+ ApiKeyAuth,
+ BasicAuth,
+ BearerAuth,
+ CookieAuth,
+ OAuth2Auth,
+ OpenIdConnectAuth
+} from './auth';
+
+export interface OpenAPI extends Info {
+ servers: Server[];
+ securitySchemas: SecuritySchema[];
+}
+
+export interface Info {
+ title: string;
+ version: string;
+ description?: string;
+}
+
+export interface Server {
+ url: string;
+ description?: string;
+}
+
+export type SecuritySchema =
+ | BasicAuth
+ | BearerAuth
+ | ApiKeyAuth
+ | OAuth2Auth
+ | OpenIdConnectAuth
+ | CookieAuth;
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index 94e037d..73ca3ca 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -3,6 +3,7 @@
import Info from '$lib/components/sections/Info.svelte';
import { TabGroup, Tab } from '@skeletonlabs/skeleton';
import { persisted } from 'svelte-persisted-store';
+ import Authentication from '$lib/components/sections/Authentication.svelte';
// let tabSet: number = 0;
const tabSet = persisted('tabSet', 0);
@@ -13,7 +14,7 @@
Info
- Authentication
+ Authentication Schemas
Servers
@@ -27,17 +28,13 @@
{#if $tabSet === 0}
- {/if}
- {#if $tabSet === 1}
- Authentication
- {/if}
- {#if $tabSet === 2}
+ {:else if $tabSet === 1}
+
+ {:else if $tabSet === 2}
- {/if}
- {#if $tabSet === 3}
+ {:else if $tabSet === 3}
Paths
- {/if}
- {#if $tabSet === 4}
+ {:else if $tabSet === 4}
Components
{/if}