removed localcopy of SwagDoc

This commit is contained in:
Daniele Teti 2023-02-27 12:32:18 +01:00
parent 7a0ac93e2d
commit 993ecf49a1
69 changed files with 0 additions and 13964 deletions

View File

@ -1,14 +0,0 @@
program GenerateSwagger;
uses
Vcl.Forms,
frmGenerate in 'frmGenerate.pas' {Form1};
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

View File

@ -1,630 +0,0 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{E52D5C06-7ED6-48F1-AEA2-4E3F6FEC7532}</ProjectGuid>
<MainSource>GenerateSwagger.dpr</MainSource>
<Base>True</Base>
<Config Condition="'$(Config)'==''">Debug</Config>
<TargetedPlatforms>1</TargetedPlatforms>
<AppType>Application</AppType>
<FrameworkType>VCL</FrameworkType>
<ProjectVersion>18.6</ProjectVersion>
<Platform Condition="'$(Platform)'==''">Win32</Platform>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
<Base_Win32>true</Base_Win32>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Base)'=='true') or '$(Base_Win64)'!=''">
<Base_Win64>true</Base_Win64>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_1)'!=''">
<Cfg_1>true</Cfg_1>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''">
<Cfg_1_Win32>true</Cfg_1_Win32>
<CfgParent>Cfg_1</CfgParent>
<Cfg_1>true</Cfg_1>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''">
<Cfg_2>true</Cfg_2>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='iOSDevice64' and '$(Cfg_2)'=='true') or '$(Cfg_2_iOSDevice64)'!=''">
<Cfg_2_iOSDevice64>true</Cfg_2_iOSDevice64>
<CfgParent>Cfg_2</CfgParent>
<Cfg_2>true</Cfg_2>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_2)'=='true') or '$(Cfg_2_Win32)'!=''">
<Cfg_2_Win32>true</Cfg_2_Win32>
<CfgParent>Cfg_2</CfgParent>
<Cfg_2>true</Cfg_2>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''">
<DCC_E>false</DCC_E>
<DCC_F>false</DCC_F>
<DCC_K>false</DCC_K>
<DCC_N>false</DCC_N>
<DCC_S>false</DCC_S>
<DCC_ImageBase>00400000</DCC_ImageBase>
<SanitizedProjectName>GenerateSwagger</SanitizedProjectName>
<DCC_Namespace>Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)</DCC_Namespace>
<VerInfo_Locale>1046</VerInfo_Locale>
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=;CFBundleName=</VerInfo_Keys>
<DCC_DcpOutput>..\..\Lib</DCC_DcpOutput>
<DCC_ExeOutput>..\..\Deploy</DCC_ExeOutput>
<DCC_BplOutput>..\..\Lib</DCC_BplOutput>
<DCC_UnitSearchPath>..\..\Source;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
<DCC_DcuOutput>..\..\Lib</DCC_DcuOutput>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win32)'!=''">
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
<BT_BuildType>Debug</BT_BuildType>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName)</VerInfo_Keys>
<VerInfo_Locale>1033</VerInfo_Locale>
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
<UWP_DelphiLogo44>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png</UWP_DelphiLogo44>
<UWP_DelphiLogo150>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png</UWP_DelphiLogo150>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win64)'!=''">
<UWP_DelphiLogo44>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png</UWP_DelphiLogo44>
<UWP_DelphiLogo150>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png</UWP_DelphiLogo150>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1)'!=''">
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
<DCC_DebugInformation>0</DCC_DebugInformation>
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
<AppDPIAwarenessMode>PerMonitor</AppDPIAwarenessMode>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''">
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
<DCC_Optimize>false</DCC_Optimize>
<DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_iOSDevice64)'!=''">
<BT_BuildType>Debug</BT_BuildType>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_Locale>1033</VerInfo_Locale>
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName)</VerInfo_Keys>
<AppDPIAwarenessMode>PerMonitor</AppDPIAwarenessMode>
</PropertyGroup>
<ItemGroup>
<DelphiCompile Include="$(MainSource)">
<MainSource>MainSource</MainSource>
</DelphiCompile>
<DCCReference Include="frmGenerate.pas">
<Form>Form1</Form>
</DCCReference>
<BuildConfiguration Include="Debug">
<Key>Cfg_2</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
<BuildConfiguration Include="Base">
<Key>Base</Key>
</BuildConfiguration>
<BuildConfiguration Include="Release">
<Key>Cfg_1</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
</ItemGroup>
<ProjectExtensions>
<Borland.Personality>Delphi.Personality.12</Borland.Personality>
<Borland.ProjectType/>
<BorlandProject>
<Delphi.Personality>
<Source>
<Source Name="MainSource">GenerateSwagger.dpr</Source>
</Source>
<Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k250.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dclofficexp250.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
</Excluded_Packages>
</Delphi.Personality>
<Platforms>
<Platform value="iOSDevice64">False</Platform>
<Platform value="Win32">True</Platform>
<Platform value="Win64">False</Platform>
</Platforms>
<Deployment Version="3">
<DeployFile LocalName="GenerateSwagger.exe" Configuration="Debug" Class="ProjectOutput">
<Platform Name="Win32">
<RemoteName>GenerateSwagger.exe</RemoteName>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployClass Name="AdditionalDebugSymbols">
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidClassesDexFile">
<Platform Name="Android">
<RemoteDir>classes</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidFileProvider">
<Platform Name="Android">
<RemoteDir>res\xml</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidGDBServer">
<Platform Name="Android">
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidLibnativeArmeabiFile">
<Platform Name="Android">
<RemoteDir>library\lib\armeabi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidLibnativeMipsFile">
<Platform Name="Android">
<RemoteDir>library\lib\mips</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidServiceOutput">
<Platform Name="Android">
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidSplashImageDef">
<Platform Name="Android">
<RemoteDir>res\drawable</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidSplashStyles">
<Platform Name="Android">
<RemoteDir>res\values</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidSplashStylesV21">
<Platform Name="Android">
<RemoteDir>res\values-v21</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_DefaultAppIcon">
<Platform Name="Android">
<RemoteDir>res\drawable</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon144">
<Platform Name="Android">
<RemoteDir>res\drawable-xxhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon36">
<Platform Name="Android">
<RemoteDir>res\drawable-ldpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon48">
<Platform Name="Android">
<RemoteDir>res\drawable-mdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon72">
<Platform Name="Android">
<RemoteDir>res\drawable-hdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon96">
<Platform Name="Android">
<RemoteDir>res\drawable-xhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_SplashImage426">
<Platform Name="Android">
<RemoteDir>res\drawable-small</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_SplashImage470">
<Platform Name="Android">
<RemoteDir>res\drawable-normal</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_SplashImage640">
<Platform Name="Android">
<RemoteDir>res\drawable-large</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_SplashImage960">
<Platform Name="Android">
<RemoteDir>res\drawable-xlarge</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="DebugSymbols">
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
</DeployClass>
<DeployClass Name="DependencyFramework">
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.framework</Extensions>
</Platform>
<Platform Name="OSX64">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.framework</Extensions>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
</DeployClass>
<DeployClass Name="DependencyModule">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="OSX64">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
<Extensions>.dll;.bpl</Extensions>
</Platform>
</DeployClass>
<DeployClass Required="true" Name="DependencyPackage">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="OSX64">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
<Extensions>.bpl</Extensions>
</Platform>
</DeployClass>
<DeployClass Name="File">
<Platform Name="Android">
<Operation>0</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>0</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>0</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>0</Operation>
</Platform>
<Platform Name="OSX32">
<RemoteDir>Contents\Resources\StartUp\</RemoteDir>
<Operation>0</Operation>
</Platform>
<Platform Name="OSX64">
<RemoteDir>Contents\Resources\StartUp\</RemoteDir>
<Operation>0</Operation>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_Launch1024">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_Launch1536">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_Launch2048">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_Launch768">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Launch320">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Launch640">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Launch640x1136">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectAndroidManifest">
<Platform Name="Android">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSDeviceDebug">
<Platform Name="iOSDevice32">
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSDeviceResourceRules">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSEntitlements">
<Platform Name="iOSDevice32">
<RemoteDir>..\</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<RemoteDir>..\</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSInfoPList">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSResource">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectOSXDebug">
<Platform Name="OSX64">
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectOSXEntitlements">
<Platform Name="OSX32">
<RemoteDir>..\</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="OSX64">
<RemoteDir>..\</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectOSXInfoPList">
<Platform Name="OSX32">
<RemoteDir>Contents</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="OSX64">
<RemoteDir>Contents</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectOSXResource">
<Platform Name="OSX32">
<RemoteDir>Contents\Resources</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="OSX64">
<RemoteDir>Contents\Resources</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Required="true" Name="ProjectOutput">
<Platform Name="Android">
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="Linux64">
<Operation>1</Operation>
</Platform>
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="OSX64">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectUWPManifest">
<Platform Name="Win32">
<Operation>1</Operation>
</Platform>
<Platform Name="Win64">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="UWP_DelphiLogo150">
<Platform Name="Win32">
<RemoteDir>Assets</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Win64">
<RemoteDir>Assets</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="UWP_DelphiLogo44">
<Platform Name="Win32">
<RemoteDir>Assets</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Win64">
<RemoteDir>Assets</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="Linux64" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="OSX32" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="Android" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="OSX64" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>
</Deployment>
</BorlandProject>
<ProjectFileVersion>12</ProjectFileVersion>
</ProjectExtensions>
<Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
<Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
<Import Project="$(MSBuildProjectName).deployproj" Condition="Exists('$(MSBuildProjectName).deployproj')"/>
</Project>

View File

@ -1,35 +0,0 @@
object Form1: TForm1
Left = 0
Top = 0
Caption = 'Generate Swagger JSON'
ClientHeight = 299
ClientWidth = 635
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Memo1: TMemo
Left = 0
Top = 47
Width = 635
Height = 252
Align = alBottom
Anchors = [akLeft, akTop, akRight, akBottom]
ScrollBars = ssBoth
TabOrder = 0
end
object btnGenerate: TButton
Left = 8
Top = 8
Width = 75
Height = 25
Caption = 'Generate'
TabOrder = 1
OnClick = btnGenerateClick
end
end

View File

@ -1,206 +0,0 @@
unit frmGenerate;
interface
uses
Winapi.Windows,
Winapi.Messages,
System.SysUtils,
System.Variants,
System.Classes,
System.Json,
Vcl.Graphics,
Vcl.Controls,
Vcl.Forms,
Vcl.Dialogs,
Vcl.StdCtrls;
type
TForm1 = class(TForm)
Memo1: TMemo;
btnGenerate: TButton;
procedure btnGenerateClick(Sender: TObject);
private
function CreateJsonSomeSubType: TJsonObject;
function CreateJsonSomeType(pJsonObjectSubType: TJsonObject): TJsonObject;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
uses
Json.Common.Helpers,
Swag.Common.Types,
Swag.Doc.Path,
Swag.Doc.Path.Operation,
Swag.Doc.Path.Operation.RequestParameter,
Swag.Doc.Path.Operation.Response,
Swag.Doc.Path.Operation.ResponseHeaders,
Swag.Doc.Definition,
Swag.Doc;
procedure TForm1.btnGenerateClick(Sender: TObject);
var
vSwagDoc: TSwagDoc;
vPath: TSwagPath;
vOperation: TSwagPathOperation;
vParam: TSwagRequestParameter;
vResponse: TSwagResponse;
vDefinitionSomeType: TSwagDefinition;
vDefinitionResponseSomeType: TSwagDefinition;
vDefinitionSomeSubType: TSwagDefinition;
vResponseHeader: TSwagHeaders;
begin
vSwagDoc := TSwagDoc.Create;
try
vSwagDoc.Info.Title := 'Sample API';
vSwagDoc.Info.Version := 'v1.2';
vSwagDoc.Info.TermsOfService := 'https://example.com/someurl/tos';
vSwagDoc.Info.Description := 'Sample API Description';
vSwagDoc.Info.Contact.Name := 'John Smith';
vSwagDoc.Info.Contact.Email := 'jsmith@example.com';
vSwagDoc.Info.Contact.Url := 'https://example.com/contact';
vSwagDoc.Info.License.Name := 'Some License';
vSwagDoc.Info.License.Url := 'https://example.com/license';
vSwagDoc.Host := 'example.com';
vSwagDoc.BasePath := '/basepath';
vSwagDoc.Consumes.Add('application/json');
vSwagDoc.Produces.Add('text/xml');
vSwagDoc.Produces.Add('application/json');
vSwagDoc.Schemes := [tpsHttps];
vDefinitionSomeSubType := TSwagDefinition.Create;
vDefinitionSomeSubType.Name := 'SomeSubType';
vDefinitionSomeSubType.JsonSchema := CreateJsonSomeSubType;
vSwagDoc.Definitions.Add(vDefinitionSomeSubType);
vDefinitionSomeType := TSwagDefinition.Create;
vDefinitionSomeType.Name := 'SomeType';
vDefinitionSomeType.JsonSchema := CreateJsonSomeType(vDefinitionSomeSubType.GenerateJsonRefDefinition);
vSwagDoc.Definitions.Add(vDefinitionSomeType);
vPath := TSwagPath.Create;
vPath.Uri := '/path/request/{param1}';
vOperation := TSwagPathOperation.Create;
vOperation.Operation := ohvPost;
vOperation.OperationId := 'RequestData';
vOperation.Description := 'Requests some data';
vParam := TSwagRequestParameter.Create;
vParam.Name := 'param1';
vParam.InLocation := rpiPath;
vParam.Description := 'A param required';
vParam.Required := True;
vParam.TypeParameter := stpString;
vOperation.Parameters.Add(vParam);
vParam := TSwagRequestParameter.Create;
vParam.Name := 'param2';
vParam.InLocation := rpiQuery;
vParam.Description := 'A param that is not required';
vParam.Required := False;
vParam.TypeParameter := stpString;
vOperation.Parameters.Add(vParam);
vParam := TSwagRequestParameter.Create;
vParam.Name := 'param3';
vParam.InLocation := rpiBody;
vParam.Required := True;
vParam.Schema.Name := 'SomeType';
vOperation.Parameters.Add(vParam);
vResponse := TSwagResponse.Create;
vResponse.StatusCode := '200';
vResponse.Description := 'Successfully retrieved data';
vResponse.Schema.Name := 'SomeType';
vOperation.Responses.Add('200', vResponse);
vResponseHeader := TSwagHeaders.Create;
vResponseHeader.Name := 'X-Rate-Limit-Limit';
vResponseHeader.Description := 'The number of allowed requests in the current period';
vResponseHeader.ValueType := 'integer';
vResponse.Headers.Add(vResponseHeader);
vResponse := TSwagResponse.Create;
vResponse.StatusCode := 'default';
vResponse.Description := 'Error occured';
vOperation.Responses.Add('default',vResponse);
vOperation.Tags.Add('TagName');
vPath.Operations.Add(vOperation);
vSwagDoc.Paths.Add(vPath);
vSwagDoc.GenerateSwaggerJson;
Memo1.Lines.Add(vSwagDoc.SwaggerJson.Format);
finally
FreeAndNil(vSwagDoc);
end;
end;
function TForm1.CreateJsonSomeSubType: TJsonObject;
var
vJsonType: TJsonObject;
vJsonProperities: TJsonObject;
begin
Result := TJsonObject.Create;
Result.AddPair('type','object');
vJsonType := TJsonObject.Create;
vJsonType.AddPair('type', 'string');
vJsonProperities := TJsonObject.Create;
vJsonProperities.AddPair('id', vJsonType);
Result.AddPair('properties', vJsonProperities);
end;
function TForm1.CreateJsonSomeType(pJsonObjectSubType: TJsonObject): TJsonObject;
var
vJsonId: TJsonObject;
vJsonCost: TJsonObject;
vJsonProperities: TJsonObject;
begin
Result := TJsonObject.Create;
Result.AddPair('type', 'object');
vJsonId := TJsonObject.Create;
vJsonId.AddPair('type', 'integer');
vJsonId.AddPair('format', 'int64');
vJsonProperities := TJsonObject.Create;
vJsonProperities.AddPair('id', vJsonId);
vJsonProperities.AddPair('subType', pJsonObjectSubType);
vJsonCost := TJsonObject.Create;
vJsonCost.AddPair('type', 'string');
vJsonCost.AddPair('format', 'decimel');
vJsonCost.AddPair('multipleOf', TJsonNumber.Create(0.01));
vJsonCost.AddPair('minimum', TJsonNumber.Create(-9999999999.99));
vJsonCost.AddPair('maximum', TJsonNumber.Create(9999999999.99));
vJsonCost.AddPair('title', 'Total Cost');
vJsonCost.AddPair('description', 'Total Cost');
vJsonCost.AddPair('example', TJsonNumber.Create(9999999999.99));
vJsonProperities.AddPair('cost', vJsonCost);
Result.AddPair('properties', vJsonProperities);
end;
initialization
ReportMemoryLeaksOnShutdown := True;
end.

View File

@ -1,16 +0,0 @@
program GenerateUnitFileForMVCFramework;
uses
System.StartUpCopy,
FMX.Forms,
Sample.Main in 'Sample.Main.pas' {Form1},
Sample.DelphiUnit.Generate in 'Sample.DelphiUnit.Generate.pas',
Sample.MvcControllerClientFileBuilder in 'Sample.MvcControllerClientFileBuilder.pas';
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

View File

@ -1,848 +0,0 @@
{******************************************************************************}
{ }
{ Delphi SwagDoc Library }
{ Copyright (c) 2018 Marcelo Jaloto }
{ https://github.com/marcelojaloto/SwagDoc }
{ }
{ Sample author: geoffsmith82 - 2019 }
{ }
{******************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{******************************************************************************}
unit Sample.DelphiUnit.Generate;
interface
uses
System.Classes,
System.Json,
System.SysUtils,
System.Rtti,
System.TypInfo,
System.Generics.Collections,
System.Generics.Defaults;
type
TUnitTypeDefinition = class;
TUnitFieldDefinition = class
strict private
fFieldName: string;
fFieldType: string;
fAttributes: TStringList;
fDescription: string;
public
constructor Create;
destructor Destroy; override;
procedure AddAttribute(const pAttribute: string);
function GenerateInterface: string;
property FieldName: string read fFieldName write fFieldName;
property FieldType: string read fFieldType write fFieldType;
property Description: string read fDescription write fDescription;
end;
TUnitParameter = class
strict private
fFlags: TParamFlags;
fType: TUnitTypeDefinition;
fParamName: string;
fAttributes: TStringList;
public
constructor Create;
destructor Destroy; override;
procedure AddAttribute(const pAttribute: string);
property Attributes: TStringList read fAttributes write fAttributes;
property ParamName: string read fParamName write fParamName;
property Flags: TParamFlags read fFlags write fFlags;
property ParamType: TUnitTypeDefinition read fType write fType;
end;
TUnitMethod = class
strict private
fAttributes: TStringList;
fMethodKind: TMethodKind;
fVisibility: TMemberVisibility;
fName: string;
fIsStatic: Boolean;
fIsClassMethod: Boolean;
fReturnType: TUnitTypeDefinition;
fParams: TObjectList<TUnitParameter>;
fVars: TObjectList<TUnitParameter>;
fContent: TStringList;
procedure ParametersToDelphiString(var pParamString: string; pIncludeAttributes: Boolean);
procedure MethodLocalVarsToDelphiString(pFuncSL: TStringList);
function MethodKindToDelphiString(var pHasReturn: Boolean): string;
function GetIsConstructor: Boolean;
function GetIsDestructor: Boolean;
public
constructor Create;
destructor Destroy; override;
procedure AddParameter(pParam: TUnitParameter);
procedure AddLocalVariable(pVar: TUnitParameter);
procedure AddAttribute(const pAttribute: string);
function GetParameters: TArray<TUnitParameter>;
function GenerateInterface: string;
function GenerateImplementation(pOnType: TUnitTypeDefinition): string;
property Content: TStringList read fContent write fContent;
property MethodKind: TMethodKind read fMethodKind write fMethodKind;
property Visibility: TMemberVisibility read fVisibility write fVisibility;
property Name: string read fName write fName;
property IsConstructor: Boolean read GetIsConstructor;
property IsDestructor: Boolean read GetIsDestructor;
property IsClassMethod: Boolean read fIsClassMethod write fIsClassMethod;
// Static: No 'Self' parameter
property IsStatic: Boolean read fIsStatic write fIsStatic;
property ReturnType: TUnitTypeDefinition read fReturnType write fReturnType;
end;
TUnitTypeDefinition = class
strict private
fTypeName: string;
fTypeInheritedFrom: string;
fAttributes: TStringList;
fTypeKind: TTypeKind;
fForwardDeclare: Boolean;
fGuid : TGUID;
fFields: TObjectList<TUnitFieldDefinition>;
fMethods: TObjectList<TUnitMethod>;
public
constructor Create;
destructor Destroy; override;
procedure AddAttribute(const pAttribute: string);
function GetMethods: TArray<TUnitMethod>;
function GenerateInterface: string;
function GenerateForwardInterface: string;
property Guid: TGUID read fGuid write fGuid;
property TypeName: string read fTypeName write fTypeName;
property TypeKind: TTypeKind read fTypeKind write fTypeKind;
property TypeInherited: string read fTypeInheritedFrom write fTypeInheritedFrom;
property ForwardDeclare: Boolean read fForwardDeclare write fForwardDeclare;
property Fields: TObjectList<TUnitFieldDefinition> read fFields;
property Methods: TObjectList<TUnitMethod> read fMethods;
end;
TDelphiUnit = class
strict private
fInterfaceUses: TStringList;
fImplementationUses: TStringList;
fInterfaceConstant: TStringList;
fInterfaceVar: TStringList;
fImplementationConstant: TStringList;
fUnitName: string;
fTitle: string;
fDescription: string;
fLicense: string;
fTypeDefinitions: TObjectList<TUnitTypeDefinition>;
fUnitHasResourceFile: Boolean;
private
function GenerateInterfaceVar: string;
public
constructor Create; virtual;
destructor Destroy; override;
function Generate: string;
function GenerateInterfaceSectionStart: string; virtual;
function GenerateInterfaceUses: string; virtual;
function GenerateImplementationSectionStart: string; virtual;
function GenerateImplementationUses: string; virtual;
function GenerateImplementationConstants: string; virtual;
function CreateGUID: TGuid;
procedure AddInterfaceUnit(const pFilename: string); virtual;
procedure AddInterfaceConstant(const pName: string; const pValue: string);
procedure AddInterfaceVar(const pName:string; pTypeInfo: TUnitTypeDefinition);
procedure AddImplementationUnit(const pFilename: string); virtual;
procedure AddImplementationConstant(const pName: string; const pValue: string);
procedure AddType(pTypeInfo: TUnitTypeDefinition);
procedure SortTypeDefinitions;
property UnitFile: string read fUnitName write fUnitName;
property UnitHasResourceFile: Boolean read fUnitHasResourceFile write fUnitHasResourceFile;
property Title: string read fTitle write fTitle;
property Description: string read fDescription write fDescription;
property License: string read fLicense write fLicense;
end;
implementation
function DelphiVarName(const pVarName: string):string;
begin
Result := pVarName;
if Result.ToLower = 'type' then
Result := '&' + Result
else if Result.ToLower = 'file' then
Result := '&' + Result;
end;
{ TDelphiUnit }
procedure TDelphiUnit.AddImplementationConstant(const pName, pValue: string);
begin
fImplementationConstant.AddPair(pName, pValue);
end;
procedure TDelphiUnit.AddImplementationUnit(const pFilename: string);
var
vInterfaceIndex : Integer;
begin
vInterfaceIndex := fInterfaceUses.IndexOf(pFilename);
if vInterfaceIndex < 0 then
begin
if fImplementationUses.IndexOf(pFilename) < 0 then
fImplementationUses.Add(pFilename);
end;
end;
procedure TDelphiUnit.AddInterfaceVar(const pName: string; pTypeInfo: TUnitTypeDefinition);
begin
fInterfaceVar.AddPair(pName, pTypeInfo.TypeName);
end;
procedure TDelphiUnit.AddInterfaceConstant(const pName, pValue: string);
begin
fInterfaceConstant.AddPair(pName, pValue);
end;
procedure TDelphiUnit.AddInterfaceUnit(const pFilename: string);
var
vImpIndex : Integer;
begin
vImpIndex := fImplementationUses.IndexOf(pFilename);
if vImpIndex >= 0 then
fImplementationUses.Delete(vImpIndex);
if fInterfaceUses.IndexOf(pFilename) < 0 then
fInterfaceUses.Add(pFilename);
end;
procedure TDelphiUnit.AddType(pTypeInfo: TUnitTypeDefinition);
begin
fTypeDefinitions.Add(pTypeInfo);
end;
constructor TDelphiUnit.Create;
begin
fInterfaceUses := TStringList.Create;
fInterfaceConstant := TStringList.Create;
fInterfaceVar := TStringList.Create;
fImplementationConstant := TStringList.Create;
fImplementationUses := TStringList.Create;
fTypeDefinitions := TObjectList<TUnitTypeDefinition>.Create;
end;
destructor TDelphiUnit.Destroy;
begin
FreeAndNil(fInterfaceUses);
FreeAndNil(fImplementationUses);
FreeAndNil(fInterfaceConstant);
FreeAndNil(fInterfaceVar);
FreeAndNil(fImplementationConstant);
FreeAndNil(fTypeDefinitions);
inherited Destroy;
end;
function TDelphiUnit.GenerateImplementationConstants: string;
var
vConstList : TStringList;
vImpIndex : Integer;
begin
vConstList := TStringList.Create;
try
if fImplementationConstant.Count > 0 then
begin
vConstList.Add('const');
for vImpIndex := 0 to fImplementationConstant.Count - 1 do
begin
vConstList.Add(' ' + fImplementationConstant.Names[vImpIndex] + ' = ' + fImplementationConstant.ValueFromIndex[vImpIndex] + ';');
end;
end;
Result := vConstList.Text;
finally
FreeAndNil(vConstList);
end;
end;
function TDelphiUnit.GenerateInterfaceVar: string;
var
vVarList: TStringList;
vImpIndex: Integer;
begin
vVarList := TStringList.Create;
try
if fInterfaceVar.Count > 0 then
begin
vVarList.Add('var');
for vImpIndex := 0 to fInterfaceVar.Count - 1 do
begin
vVarList.Add(' ' + fInterfaceVar.Names[vImpIndex] + ' : ' + fInterfaceVar.ValueFromIndex[vImpIndex] + ';');
end;
end;
Result := vVarList.Text;
finally
FreeAndNil(vVarList);
end;
end;
function TDelphiUnit.GenerateImplementationSectionStart: string;
var
vImplementationSection: TStringList;
begin
vImplementationSection := TStringList.Create;
try
vImplementationSection.Add('');
vImplementationSection.Add('implementation');
vImplementationSection.Add('');
Result := vImplementationSection.Text;
finally
FreeAndNil(vImplementationSection);
end;
end;
function TDelphiUnit.GenerateImplementationUses: string;
var
vUsesList: TStringList;
vImplIndex: Integer;
begin
vUsesList := TStringList.Create;
try
if fUnitHasResourceFile then
vUsesList.Add('{$R *.dfm}');
vUsesList.Add('');
if fImplementationUses.Count > 0 then
begin
vUsesList.Add('uses');
for vImplIndex := 0 to fImplementationUses.Count - 1 do
begin
if vImplIndex = 0 then
vUsesList.Add(' ' + fImplementationUses[vImplIndex])
else
vUsesList.Add(' , ' + fImplementationUses[vImplIndex]);
end;
vUsesList.Add(' ;');
end;
vUsesList.Add('');
Result := vUsesList.Text;
finally
FreeAndNil(vUsesList);
end;
end;
function TDelphiUnit.GenerateInterfaceSectionStart: string;
var
vInterfaceSectionList: TStringList;
begin
vInterfaceSectionList := TStringList.Create;
try
vInterfaceSectionList.Add('unit ' + UnitFile + ';');
vInterfaceSectionList.Add('');
vInterfaceSectionList.Add('interface');
vInterfaceSectionList.Add('');
Result := vInterfaceSectionList.Text;
finally
FreeAndNil(vInterfaceSectionList);
end;
end;
function TDelphiUnit.GenerateInterfaceUses: string;
var
vUsesList: TStringList;
vUseIndex: Integer;
begin
vUsesList := TStringList.Create;
try
if fInterfaceUses.Count > 0 then
begin
vUsesList.Add('uses');
for vUseIndex := 0 to fInterfaceUses.Count - 1 do
begin
if vUseIndex = 0 then
vUsesList.Add(' ' + fInterfaceUses[vUseIndex])
else
vUsesList.Add(' , ' + fInterfaceUses[vUseIndex]);
end;
vUsesList.Add(' ;');
end;
vUsesList.Add('');
Result := vUsesList.Text;
finally
FreeAndNil(vUsesList);
end;
end;
function TDelphiUnit.Generate: string;
var
vIndex: Integer;
vMethod: TUnitMethod;
vUnitFileList: TStringList;
vForwardAlreadyDeclared: Boolean;
begin
vForwardAlreadyDeclared := False;
vUnitFileList := TStringList.Create;
try
vUnitFileList.Add(GenerateInterfaceSectionStart);
vUnitFileList.Add(GenerateInterfaceUses);
vUnitFileList.Add('(*');
vUnitFileList.Add('Title: ' + Title);
vUnitFileList.Add('Description: ' + Description);
vUnitFileList.Add('License: ' + License);
vUnitFileList.Add('*)');
vUnitFileList.Add('');
vUnitFileList.Add('type');
SortTypeDefinitions;
if fInterfaceConstant.Count > 0 then
begin
vUnitFileList.Add('const');
for vIndex := 0 to fInterfaceConstant.Count - 1 do
begin
vUnitFileList.Add(' ' + fInterfaceConstant.Names[vIndex] + ' = ' + fInterfaceConstant.ValueFromIndex[vIndex] + ';');
end;
end;
for vIndex := 0 to fTypeDefinitions.Count - 1 do
begin
if fTypeDefinitions[vIndex].ForwardDeclare then
begin
if not vForwardAlreadyDeclared then
vUnitFileList.Add(' // Forward Declarations');
vUnitFileList.Add(fTypeDefinitions[vIndex].GenerateForwardInterface);
vForwardAlreadyDeclared := True;
end;
end;
for vIndex := 0 to fTypeDefinitions.Count - 1 do
begin
vUnitFileList.Add(fTypeDefinitions[vIndex].GenerateInterface);
end;
vUnitFileList.Add(GenerateInterfaceVar);
vUnitFileList.Add(GenerateImplementationSectionStart);
vUnitFileList.Add(GenerateImplementationUses);
vUnitFileList.Add('');
GenerateImplementationConstants;
for vIndex := 0 to fTypeDefinitions.Count - 1 do
begin
for vMethod in fTypeDefinitions[vIndex].GetMethods do
begin
vUnitFileList.Add(vMethod.GenerateImplementation(fTypeDefinitions[vIndex]));
end;
end;
vUnitFileList.Add('end.');
Result := vUnitFileList.Text;
finally
FreeAndNil(vUnitFileList);
end;
end;
function TDelphiUnit.CreateGUID: TGuid;
var
vGuid: TGUID;
begin
System.SysUtils.CreateGuid(vGuid);
Result := vGuid;
end;
procedure TDelphiUnit.SortTypeDefinitions;
begin
{ TODO : Make this much more advanced to handle dependency ordering of declarations }
fTypeDefinitions.Sort(TComparer<TUnitTypeDefinition>.Construct(
function(const vTypeA, vTypeB: TUnitTypeDefinition): Integer
begin
if vTypeA.TypeName = 'TMyMVCController' then
Result := 1
else if vTypeB.TypeName = 'TMyMVCController' then
Result := -1
else
Result := CompareText(vTypeA.TypeName, vTypeB.TypeName);
end));
end;
{ TTypeDefinition }
constructor TUnitTypeDefinition.Create;
begin
fAttributes := TStringList.Create;
fFields := TObjectList<TUnitFieldDefinition>.Create;
fMethods := TObjectList<TUnitMethod>.Create;
fTypeKind := tkClass;
fForwardDeclare := False;
end;
destructor TUnitTypeDefinition.Destroy;
begin
FreeAndNil(fAttributes);
FreeAndNil(fFields);
FreeAndNil(fMethods);
inherited Destroy;
end;
procedure TUnitTypeDefinition.AddAttribute(const pAttribute: string);
begin
fAttributes.Add(pAttribute);
end;
function TUnitTypeDefinition.GenerateForwardInterface: string;
begin
if fTypeKind = tkClass then
Result := ' ' + TypeName + ' : class;'
else if fTypeKind = tkInterface then
Result := ' ' + TypeName + ' : interface;'
else
Result := ' ' + TypeName + 'xxxx';
end;
function TUnitTypeDefinition.GenerateInterface: string;
var
vInterfaceList: TStringList;
vAttributeIndex: Integer;
vFieldIndex: Integer;
begin
vInterfaceList := TStringList.Create;
try
for vAttributeIndex := 0 to fAttributes.Count - 1 do
begin
vInterfaceList.Add(fAttributes[vAttributeIndex]);
end;
if fTypeKind = tkClass then
begin
if TypeInherited.Length > 0 then
vInterfaceList.Add(' ' + TypeName + ' = class(' + TypeInherited + ')')
else
vInterfaceList.Add(' ' + TypeName + ' = class');
end
else if fTypeKind = tkInterface then
begin
if TypeInherited.Length > 0 then
begin
vInterfaceList.Add(' ' + TypeName + ' = interface(' + TypeInherited + ')');
vInterfaceList.Add(' [' + GUIDToString(fGuid).QuotedString + ']');
end
else
begin
vInterfaceList.Add(' ' + TypeName + ' = interface');
vInterfaceList.Add(' [' + GUIDToString(fGuid).QuotedString + ']');
end;
end;
for vFieldIndex := 0 to fFields.Count - 1 do
begin
vInterfaceList.Add(fFields[vFieldIndex].GenerateInterface);
end;
for vFieldIndex := 0 to fMethods.Count - 1 do
begin
vInterfaceList.Add(TrimRight(fMethods[vFieldIndex].GenerateInterface));
vInterfaceList.Add('');
end;
vInterfaceList.Add(' end;');
Result := vInterfaceList.Text;
finally
FreeAndNil(vInterfaceList);
end;
end;
function TUnitTypeDefinition.GetMethods: TArray<TUnitMethod>;
var
vMethodIndex: Integer;
begin
SetLength(Result, fMethods.Count);
for vMethodIndex := 0 to fMethods.Count - 1 do
begin
Result[vMethodIndex] := fMethods[vMethodIndex];
end;
end;
{ TFieldDefinition }
constructor TUnitFieldDefinition.Create;
begin
fAttributes := TStringList.Create;
end;
destructor TUnitFieldDefinition.Destroy;
begin
FreeAndNil(fAttributes);
inherited Destroy;
end;
procedure TUnitFieldDefinition.AddAttribute(const pAttribute: string);
begin
fAttributes.Add(pAttribute);
end;
function TUnitFieldDefinition.GenerateInterface: string;
var
vAttributeIndex: Integer;
vInterfaceList: TStringList;
vType: string;
begin
vInterfaceList := TStringList.Create;
try
vType := fFieldType;
for vAttributeIndex := 0 to fAttributes.Count - 1 do
begin
vInterfaceList.Add(' ' + fAttributes[vAttributeIndex]);
end;
if Description.Length > 0 then
vInterfaceList.Add(' [MVCDoc(' + QuotedStr(Description) + ')]');
vInterfaceList.Add(' ' + DelphiVarName(fFieldName + ' : ' + vType + ';'));
Result := vInterfaceList.Text;
finally
FreeAndNil(vInterfaceList);
end;
end;
{ TUnitMethod }
constructor TUnitMethod.Create;
begin
fParams := TObjectList<TUnitParameter>.Create;
fAttributes := TStringList.Create;
fVars := TObjectList<TUnitParameter>.Create;
fContent := TStringList.Create;
end;
destructor TUnitMethod.Destroy;
begin
FreeAndNil(fParams);
FreeAndNil(fAttributes);
FreeAndNil(fVars);
FreeAndNil(fContent);
inherited Destroy;
end;
procedure TUnitMethod.AddAttribute(const pAttribute: string);
begin
fAttributes.Add(pAttribute);
end;
procedure TUnitMethod.AddLocalVariable(pVar: TUnitParameter);
begin
fVars.Add(pVar);
end;
procedure TUnitMethod.AddParameter(pParam: TUnitParameter);
begin
fParams.Add(pParam);
end;
procedure TUnitMethod.MethodLocalVarsToDelphiString(pFuncSL: TStringList);
var
vVarIndex: Integer;
begin
if fVars.Count <= 0 then
Exit;
pFuncSL.Add('var');
for vVarIndex := 0 to fVars.Count - 1 do
begin
pFuncSL.Add(' ' + fVars[vVarIndex].ParamName + ' : ' + fVars[vVarIndex].ParamType.TypeName + ';');
end;
end;
procedure TUnitMethod.ParametersToDelphiString(var pParamString: string; pIncludeAttributes: Boolean);
var
vParam: TUnitParameter;
vParamFlagString: string;
vParamName: string;
vParamAttributeString : string;
vAttributeIndex: Integer;
begin
pParamString := '(';
for vParam in GetParameters do
begin
vParamFlagString := '';
if pfConst in vParam.Flags then
vParamFlagString := 'const'
else if pfVar in vParam.Flags then
vParamFlagString := 'var'
else if pfOut in vParam.Flags then
vParamFlagString := 'out'
else if pfArray in vParam.Flags then
vParamFlagString := 'array of';
if vParamFlagString.Length > 0 then
vParamFlagString := vParamFlagString + ' ';
if pIncludeAttributes then
begin
for vAttributeIndex := 0 to vParam.Attributes.Count - 1 do
begin
vParamAttributeString := vParamAttributeString + ' ' + vParam.Attributes[vAttributeIndex];
end;
vParamAttributeString := Trim(vParamAttributeString) + ' ';
end;
vParamName := DelphiVarName(vParam.ParamName);
pParamString := pParamString + vParamAttributeString + vParamFlagString + vParamName + ': ' + vParam.ParamType.TypeName + '; ';
end;
if pParamString.EndsWith('; ') then
pParamString := pParamString.Remove(pParamString.Length - 2);
pParamString := pParamString + ')';
if pParamString = '()' then
pParamString := '';
end;
function TUnitMethod.MethodKindToDelphiString(var pHasReturn: Boolean): string;
begin
case MethodKind of
mkProcedure:
Result := 'procedure';
mkFunction:
begin
Result := 'function';
pHasReturn := True;
end;
mkDestructor:
Result := 'destructor';
mkConstructor:
Result := 'constructor';
mkClassFunction:
begin
Result := 'class function';
pHasReturn := True;
end;
mkClassProcedure:
Result := 'class procedure';
mkClassConstructor:
Result := 'class constructor';
mkClassDestructor:
Result := 'class destructor';
else
Result := 'unknown';
end;
end;
function TUnitMethod.GenerateImplementation(pOnType: TUnitTypeDefinition): string;
var
vProcTypeString: string;
vHasReturn: Boolean;
vParamString: string;
vClassNameProcIn: string;
vFunctionList: TStringList;
begin
vHasReturn := False;
vClassNameProcIn := '';
vProcTypeString := MethodKindToDelphiString(vHasReturn);
if Assigned(pOnType) then
vClassNameProcIn := pOnType.TypeName + '.';
ParametersToDelphiString(vParamString, False);
if vHasReturn then
Result := vProcTypeString + ' ' + vClassNameProcIn + fName + vParamString + ': ' + ReturnType.TypeName + ';'
else
Result := vProcTypeString + ' ' + vClassNameProcIn + fName + vParamString + ';';
vFunctionList := TStringList.Create;
try
vFunctionList.Text := Result;
MethodLocalVarsToDelphiString(vFunctionList);
vFunctionList.Add('begin');
vFunctionList.Add(Content.Text);
vFunctionList.Add('end;');
Result := vFunctionList.Text;
finally
FreeAndNil(vFunctionList);
end;
end;
function TUnitMethod.GenerateInterface: string;
var
vProcTypeString: string;
vHasReturn: Boolean;
vParamString: string;
vAttributeString: string;
begin
vHasReturn := False;
vProcTypeString := MethodKindToDelphiString(vHasReturn);
ParametersToDelphiString(vParamString, True);
if vHasReturn then
Result := ' ' + vProcTypeString + ' ' + fName + vParamString + ': ' + ReturnType.TypeName + ';'
else
Result := ' ' + vProcTypeString + ' ' + fName + vParamString + ';';
vAttributeString := fAttributes.Text;
Result := vAttributeString + Result;
end;
function TUnitMethod.GetIsConstructor: Boolean;
begin
Result := MethodKind = mkConstructor;
end;
function TUnitMethod.GetIsDestructor: Boolean;
begin
Result := MethodKind = mkDestructor;
end;
function TUnitMethod.GetParameters: TArray<TUnitParameter>;
var
vParam: Integer;
begin
SetLength(Result, fParams.Count);
for vParam := 0 to fParams.Count - 1 do
begin
Result[vParam] := fParams[vParam];
end;
end;
{ TUnitParameter }
constructor TUnitParameter.Create;
begin
fAttributes := TStringList.Create;
end;
destructor TUnitParameter.Destroy;
begin
FreeAndNil(fAttributes);
FreeAndNil(fType);
inherited Destroy;
end;
procedure TUnitParameter.AddAttribute(const pAttribute: string);
begin
fAttributes.Add(pAttribute);
end;
end.

View File

@ -1,86 +0,0 @@
object Form1: TForm1
Left = 0
Top = 0
Caption = 'Sample Api with Documentation Swagger using SwagDoc'
ClientHeight = 685
ClientWidth = 605
FormFactor.Width = 320
FormFactor.Height = 480
FormFactor.Devices = [Desktop]
DesignerMasterStyle = 0
object TabControl1: TTabControl
Align = Bottom
Position.Y = 40.000000000000000000
Size.Width = 605.000000000000000000
Size.Height = 645.000000000000000000
Size.PlatformDefault = False
TabIndex = 1
TabOrder = 2
TabPosition = PlatformDefault
Sizes = (
605s
619s
605s
619s)
object TabItem1: TTabItem
CustomIcon = <
item
end>
IsSelected = False
Size.Width = 98.000000000000000000
Size.Height = 26.000000000000000000
Size.PlatformDefault = False
StyleLookup = ''
TabOrder = 0
Text = 'Swagger JSON'
ExplicitSize.cx = 98.000000000000000000
ExplicitSize.cy = 26.000000000000000000
object Memo1: TMemo
Touch.InteractiveGestures = [Pan, LongTap, DoubleTap]
DataDetectorTypes = []
Align = Client
Size.Width = 605.000000000000000000
Size.Height = 619.000000000000000000
Size.PlatformDefault = False
TabOrder = 0
Viewport.Width = 601.000000000000000000
Viewport.Height = 615.000000000000000000
end
end
object TabItem2: TTabItem
CustomIcon = <
item
end>
IsSelected = True
Size.Width = 89.000000000000000000
Size.Height = 26.000000000000000000
Size.PlatformDefault = False
StyleLookup = ''
TabOrder = 0
Text = 'Delphi Client'
ExplicitSize.cx = 136.000000000000000000
ExplicitSize.cy = 26.000000000000000000
object Memo2: TMemo
Touch.InteractiveGestures = [Pan, LongTap, DoubleTap]
DataDetectorTypes = []
Align = Client
Size.Width = 605.000000000000000000
Size.Height = 619.000000000000000000
Size.PlatformDefault = False
TabOrder = 0
Viewport.Width = 601.000000000000000000
Viewport.Height = 615.000000000000000000
end
end
end
object btnGenerateClient: TButton
Position.X = 24.000000000000000000
Position.Y = 8.000000000000000000
Size.Width = 121.000000000000000000
Size.Height = 22.000000000000000000
Size.PlatformDefault = False
TabOrder = 3
Text = 'Generate Client'
OnClick = btnGenerateClientClick
end
end

View File

@ -1,98 +0,0 @@
{******************************************************************************}
{ }
{ Delphi SwagDoc Library }
{ Copyright (c) 2018 Marcelo Jaloto }
{ https://github.com/marcelojaloto/SwagDoc }
{ }
{ Sample author: geoffsmith82 - 2019 }
{ }
{******************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{******************************************************************************}
unit Sample.Main;
interface
uses
System.SysUtils,
System.Types,
System.UITypes,
System.Classes,
System.Variants,
FMX.Types,
FMX.Controls,
FMX.Forms,
FMX.Graphics,
FMX.Dialogs,
FMX.Controls.Presentation,
FMX.StdCtrls,
FMX.ScrollBox,
FMX.Memo,
FMX.TabControl;
type
TForm1 = class(TForm)
Memo1: TMemo;
TabControl1: TTabControl;
TabItem1: TTabItem;
TabItem2: TTabItem;
Memo2: TMemo;
btnGenerateClient: TButton;
procedure btnGenerateClientClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.fmx}
uses
System.IOUtils,
Swag.Doc,
Sample.MvcControllerClientFileBuilder;
procedure TForm1.btnGenerateClientClick(Sender: TObject);
var
vClientBuilder: TSwagDocToDelphiRESTClientBuilder;
vSwagDoc: TSwagDoc;
vFilename: string;
begin
vSwagDoc := TSwagDoc.Create;
try
vFilename := ExtractFilePath(ParamStr(0)) + 'Swagger.json';
vSwagDoc.LoadFromFile(vFilename);
memo1.Lines.Text := TFile.ReadAllText(vFilename);
vClientBuilder := TSwagDocToDelphiRESTClientBuilder.Create(vSwagDoc);
try
memo2.Lines.Text := vClientBuilder.Generate;
finally
FreeAndNil(vClientBuilder);
end;
finally
FreeAndNil(vSwagDoc);
end;
end;
initialization
ReportMemoryLeaksOnShutdown := True;
end.

View File

@ -1,422 +0,0 @@
{******************************************************************************}
{ }
{ Delphi SwagDoc Library }
{ Copyright (c) 2018 Marcelo Jaloto }
{ https://github.com/marcelojaloto/SwagDoc }
{ }
{ Sample author: geoffsmith82 - 2019 }
{ }
{******************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{******************************************************************************}
unit Sample.MvcControllerClientFileBuilder;
interface
uses
System.Classes,
System.Json,
System.SysUtils,
System.Generics.Collections,
System.Generics.Defaults,
Swag.Doc,
Swag.Common.Types,
Swag.Doc.Path.Operation,
Swag.Doc.Path.Operation.Response,
Swag.Doc.Path.Operation.RequestParameter,
Sample.DelphiUnit.Generate;
type
TSwagDocToDelphiRESTClientBuilder = class(TObject)
strict private
fSwagDoc: TSwagDoc;
function CapitalizeFirstLetter(const pTypeName: string): string;
function RewriteUriToSwaggerWay(const pUri: string): string;
function OperationIdToFunctionName(pOperation: TSwagPathOperation): string;
function GenerateUnitText(pDelphiUnit: TDelphiUnit): string;
function ConvertSwaggerTypeToDelphiType(pSwaggerType: TSwagRequestParameter): TUnitTypeDefinition;
function ConvertRefToType(const pRef: string): string;
function ConvertRefToVarName(const pRef: string): string;
procedure ChildType(pDelphiUnit: TDelphiUnit; pJson: TJSONPair);
procedure HandleArray(pField: TUnitFieldDefinition; pJson: TJSONPair);
procedure ConvertSwaggerDefinitionsToTypeDefinitions(pDelphiUnit: TDelphiUnit);
public
constructor Create(pSwagDoc: TSwagDoc); reintroduce;
function Generate: string;
end;
implementation
uses
Winapi.Windows,
System.IOUtils,
System.TypInfo,
Json.Common.Helpers;
{ TSwagDocToDelphiMVCFrameworkBuilder }
constructor TSwagDocToDelphiRESTClientBuilder.Create(pSwagDoc: TSwagDoc);
begin
inherited Create;
fSwagDoc := pSwagDoc;
end;
function TSwagDocToDelphiRESTClientBuilder.OperationIdToFunctionName(pOperation: TSwagPathOperation): string;
begin
Result := pOperation.OperationId.Replace('{','').Replace('}','').Replace('-','');
if not CharInSet(Result[1], ['a'..'z','A'..'Z']) then
Result := 'F' + Result;
Result := CapitalizeFirstLetter(Result);
end;
function TSwagDocToDelphiRESTClientBuilder.RewriteUriToSwaggerWay(const pUri: string): string;
begin
Result := pUri.Replace('{','($').Replace('}',')');
end;
function TSwagDocToDelphiRESTClientBuilder.CapitalizeFirstLetter(const pTypeName: string): string;
begin
if pTypeName.Length > 2 then
Result := Copy(pTypeName, 1, 1).ToUpper + Copy(pTypeName, 2, pTypeName.Length - 1)
else
Result := pTypeName;
end;
function TSwagDocToDelphiRESTClientBuilder.ConvertRefToType(const pRef: string): string;
begin
Result := Copy(pRef, pRef.LastIndexOf('/') + 2);
Result := Copy(Result,1,1).ToUpper + Copy(Result,2);
if Result.ToLower <> 'string' then
Result := 'T' + Result;
end;
function TSwagDocToDelphiRESTClientBuilder.ConvertRefToVarName(const pRef: string): string;
begin
Result := Copy(pRef, pRef.LastIndexOf('/') + 2);
end;
function TSwagDocToDelphiRESTClientBuilder.Generate: string;
var
vPathIndex: Integer;
vOperationIndex: Integer;
vParameterIndex: Integer;
vDelphiUnit: TDelphiUnit;
vMVCControllerClient: TUnitTypeDefinition;
vMethod: TUnitMethod;
vResponse: TPair<string, TSwagResponse>;
vSchemaObj: TJsonObject;
vResultParam: TUnitParameter;
vField: TUnitFieldDefinition;
vRef: String;
begin
vDelphiUnit := TDelphiUnit.Create;
try
vDelphiUnit.UnitFile := 'UnitFilenameMvcControllerClient';
vDelphiUnit.AddInterfaceUnit('IPPeerClient');
vDelphiUnit.AddInterfaceUnit('REST.Client');
vDelphiUnit.AddInterfaceUnit('REST.Authenticator.OAuth');
vDelphiUnit.AddInterfaceUnit('REST.Types');
vDelphiUnit.AddInterfaceUnit('MVCFramework');
vDelphiUnit.AddInterfaceUnit('MVCFramework.Commons');
vDelphiUnit.AddImplementationUnit('Swag.Doc');
ConvertSwaggerDefinitionsToTypeDefinitions(vDelphiUnit);
vMVCControllerClient := TUnitTypeDefinition.Create;
vMVCControllerClient.TypeName := 'TMyMVCControllerClient';
vMVCControllerClient.TypeInherited := 'TObject';
vMVCControllerClient.AddAttribute(' [MVCPath(''' + RewriteUriToSwaggerWay(fSwagDoc.BasePath) + ''')]');
vField := TUnitFieldDefinition.Create;
vField.FieldName := 'RESTClient';
vField.FieldType := 'TRESTClient';
vMVCControllerClient.Fields.Add(vField);
vField := TUnitFieldDefinition.Create;
vField.FieldName := 'RESTRequest';
vField.FieldType := 'TRESTRequest';
vMVCControllerClient.Fields.Add(vField);
vField := TUnitFieldDefinition.Create;
vField.FieldName := 'RESTResponse';
vField.FieldType := 'TRESTResponse';
vMVCControllerClient.Fields.Add(vField);
vDelphiUnit.AddType(vMVCControllerClient);
ConvertSwaggerDefinitionsToTypeDefinitions(vDelphiUnit);
for vPathIndex := 0 to fSwagDoc.Paths.Count - 1 do
begin
for vOperationIndex := 0 to fSwagDoc.Paths[vPathIndex].Operations.Count - 1 do
begin
vMethod := TUnitMethod.Create;
if fSwagDoc.Paths[vPathIndex].Operations[vOperationIndex].Description.Trim.Length > 0 then
vMethod.AddAttribute(' [MVCDoc(' + QuotedStr(fSwagDoc.Paths[vPathIndex].Operations[vOperationIndex].Description) + ')]');
vMethod.AddAttribute(' [MVCPath(''' + fSwagDoc.Paths[vPathIndex].Uri + ''')]');
vMethod.AddAttribute(' [MVCHTTPMethod([http' + fSwagDoc.Paths[vPathIndex].Operations[vOperationIndex].OperationToString + '])]');
vMethod.Name := OperationIdToFunctionName(fSwagDoc.Paths[vPathIndex].Operations[vOperationIndex]);
for vParameterIndex := 0 to fSwagDoc.Paths[vPathIndex].Operations[vOperationIndex].Parameters.Count - 1 do
begin
vResultParam := TUnitParameter.Create;
vResultParam.ParamName := CapitalizeFirstLetter(fSwagDoc.Paths[vPathIndex].Operations[vOperationIndex].Parameters[vParameterIndex].Name);
vResultParam.ParamType := ConvertSwaggerTypeToDelphiType(fSwagDoc.Paths[vPathIndex].Operations[vOperationIndex].Parameters[vParameterIndex]);
vMethod.AddParameter(vResultParam);
end;
for vResponse in fSwagDoc.Paths[vPathIndex].Operations[vOperationIndex].Responses do
begin
vSchemaObj := vResponse.Value.Schema.JsonSchema;
if vSchemaObj = nil then
continue;
if vSchemaObj.TryGetValue('$ref', vRef) then
begin
vMethod.AddAttribute(' [MVCResponse(' + vResponse.Key + ', ' +
QuotedStr(vResponse.Value.Description) + ', ' + ConvertRefToType(vRef) + ')]');
vResultParam := TUnitParameter.Create;
vResultParam.ParamName := ConvertRefToVarName(vRef);
vResultParam.ParamType := TUnitTypeDefinition.Create;
vResultParam.ParamType.TypeName := ConvertRefToType(vRef);
vMethod.AddLocalVariable(vResultParam);
vMethod.Content.Add(' ' + ConvertRefToVarName(vRef) + ' := ' + ConvertRefToType(vRef) + '.Create;');
// method.Content.Add(' Render(' + response.Key + ', ' + ConvertRefToVarName(ref) + ');');
end
else
begin
if not vSchemaObj.TryGetValue('properties', vSchemaObj) then
continue;
if not vSchemaObj.TryGetValue('employees', vSchemaObj) then
continue;
if not vSchemaObj.TryGetValue('items', vSchemaObj) then
continue;
if vSchemaObj.TryGetValue('$ref', vRef) then
begin
vMethod.AddAttribute(' [MVCResponseList(' + vResponse.Key + ', ' +
QuotedStr(vResponse.Value.Description) + ', ' + ConvertRefToType(vRef) + ')]');
vResultParam := TUnitParameter.Create;
vResultParam.ParamName := ConvertRefToVarName(vRef);
vResultParam.ParamType := TUnitTypeDefinition.Create;
vResultParam.ParamType.TypeName := 'TObjectList<' + ConvertRefToType(vRef) + '>';
vMethod.AddLocalVariable(vResultParam);
vDelphiUnit.AddInterfaceUnit('Generics.Collections');
vMethod.Content.Add(' ' + ConvertRefToVarName(vRef) + ' := TObjectList<' + ConvertRefToType(vRef) + '>.Create;');
end;
end;
end;
vMVCControllerClient.Methods.Add(vMethod);
end;
end;
vDelphiUnit.SortTypeDefinitions;
Result := GenerateUnitText(vDelphiUnit);
finally
vDelphiUnit.Free;
end;
end;
procedure TSwagDocToDelphiRESTClientBuilder.HandleArray(pField : TUnitFieldDefinition; pJson: TJSONPair);
var
vJsonObj: TJSONObject;
vJsonVal: TJSONValue;
vType: string;
begin
if Assigned(((pJson.JsonValue as TJSONObject).Values['items'] as TJSONObject).Values['type']) then
begin
vType := ((pJson.JsonValue as TJSONObject).Values['items'] as TJSONObject).Values['type'].Value;
if vType.ToLower <> 'string' then
vType := 'T' + vType;
pField.FieldType := 'array of ' + vType;
end
else
begin
OutputDebugString(PChar(pJson.ToJSON));
vJsonVal := (pJson.JsonValue as TJSONObject).Values['items'] as TJSONObject;
OutputDebugString(PChar(vJsonVal.ToJSON));
vJsonObj := vJsonVal as TJSONObject;
vJsonVal := vJsonObj.Values['$ref'];
OutputDebugString(PChar(vJsonVal.Value));
pField.FieldType := 'array of ' + ConvertRefToType(vJsonVal.value);
end;
end;
procedure TSwagDocToDelphiRESTClientBuilder.ChildType(pDelphiUnit : TDelphiUnit; pJson: TJSONPair);
var
vTypeInfo: TUnitTypeDefinition;
vJsonProps: TJSONObject;
vFieldInfo: TUnitFieldDefinition;
vTypeObj: TJSONObject;
vJsonPropIndex: Integer;
vValue : string;
begin
OutputDebugString(PChar('Child: ' + pJson.ToJSON));
vTypeInfo := TUnitTypeDefinition.Create;
vTypeInfo.TypeName := 'T' + CapitalizeFirstLetter(pJson.JSONString.Value);
vJsonProps := (pJson.JSONValue as TJSONObject).Values['properties'] as TJSONObject;
for vJsonPropIndex := 0 to vJsonProps.Count - 1 do
begin
OutputDebugString(PChar(vJsonProps.Pairs[vJsonPropIndex].ToJSON));
vFieldInfo := TUnitFieldDefinition.Create;
vFieldInfo.FieldName := vJsonProps.Pairs[vJsonPropIndex].JsonString.Value;
vTypeObj := vJsonProps.Pairs[vJsonPropIndex].JsonValue as TJSONObject;
vFieldInfo.FieldType := vTypeObj.Values['type'].Value;
if vFieldInfo.FieldType = 'number' then
vFieldInfo.FieldType := 'Double'
else if vFieldInfo.FieldType = 'object' then
begin
vFieldInfo.FieldType := 'T' + CapitalizeFirstLetter(vJsonProps.Pairs[vJsonPropIndex].JsonString.Value);
ChildType(pDelphiUnit, vJsonProps.Pairs[vJsonPropIndex]);
end;
if vTypeObj.TryGetValue('description', vValue) then
vFieldInfo.AddAttribute('[MVCDoc(' + QuotedStr(vValue) + ')]');
if vTypeObj.TryGetValue('format', vValue) then
begin
if (vFieldInfo.FieldType.ToLower = 'integer') and (vValue.ToLower = 'int64') then
vFieldInfo.FieldType := 'Int64';
vFieldInfo.AddAttribute('[MVCFormat(' + QuotedStr(vValue) + ')]');
end;
if vTypeObj.TryGetValue('maxLength', vValue) then
vFieldInfo.AddAttribute('[MVCMaxLength(' + vValue + ')]');
vTypeInfo.Fields.Add(vFieldInfo);
end;
pDelphiUnit.AddType(vTypeInfo);
end;
procedure TSwagDocToDelphiRESTClientBuilder.ConvertSwaggerDefinitionsToTypeDefinitions(pDelphiUnit: TDelphiUnit);
var
vTypeInfo: TUnitTypeDefinition;
vJsonProps: TJSONObject;
vFieldInfo: TUnitFieldDefinition;
vTypeObj: TJSONObject;
DefinitionIndex: Integer;
vJsonPropIndex: Integer;
vValue : string;
begin
for DefinitionIndex := 0 to fSwagDoc.Definitions.Count - 1 do
begin
vTypeInfo := TUnitTypeDefinition.Create;
vTypeInfo.TypeName := 'T' + CapitalizeFirstLetter(fSwagDoc.Definitions[DefinitionIndex].Name);
vJsonProps := fSwagDoc.Definitions[DefinitionIndex].JsonSchema.Values['properties'] as TJSONObject;
for vJsonPropIndex := 0 to vJsonProps.Count - 1 do
begin
OutputDebugString(PChar(vJsonProps.Pairs[vJsonPropIndex].ToJSON));
vFieldInfo := TUnitFieldDefinition.Create;
vFieldInfo.FieldName := vJsonProps.Pairs[vJsonPropIndex].JsonString.Value;
vTypeObj := vJsonProps.Pairs[vJsonPropIndex].JsonValue as TJSONObject;
if Assigned(vTypeObj.Values['type']) then
vFieldInfo.FieldType := vTypeObj.Values['type'].Value
else
vFieldInfo.FieldType := ConvertRefToType(vTypeObj.Values['$ref'].Value);
if vFieldInfo.FieldType = 'number' then
vFieldInfo.FieldType := 'Double'
else if vFieldInfo.FieldType = 'object' then
begin
vFieldInfo.FieldType := 'T' + CapitalizeFirstLetter(vJsonProps.Pairs[vJsonPropIndex].JsonString.Value);
ChildType(pDelphiUnit, vJsonProps.Pairs[vJsonPropIndex]);
end
else if vFieldInfo.FieldType = 'array' then
begin
HandleArray(vFieldInfo, vJsonProps.Pairs[vJsonPropIndex]);
end;
if vTypeObj.TryGetValue('description', vValue) then
begin
if vValue.Trim.Length > 0 then
vFieldInfo.AddAttribute('[MVCDoc(' + QuotedStr(vValue) + ')]');
end;
if vTypeObj.TryGetValue('format', vValue) then
begin
if (vFieldInfo.FieldType.ToLower = 'integer') and (vValue.ToLower = 'int64') then
vFieldInfo.FieldType := 'Int64';
vFieldInfo.AddAttribute('[MVCFormat(' + QuotedStr(vValue) + ')]');
end;
if vTypeObj.TryGetValue('maxLength', vValue) then
vFieldInfo.AddAttribute('[MVCMaxLength(' + vValue + ')]');
if vTypeObj.TryGetValue('minimum', vValue) then
vFieldInfo.AddAttribute('[MVCMinimum(' + vValue + ')]');
if vTypeObj.TryGetValue('maximum', vValue) then
vFieldInfo.AddAttribute('[MVCMaximum(' + vValue + ')]');
vTypeInfo.Fields.Add(vFieldInfo);
end;
pDelphiUnit.AddType(vTypeInfo);
end;
end;
function TSwagDocToDelphiRESTClientBuilder.ConvertSwaggerTypeToDelphiType(pSwaggerType: TSwagRequestParameter): TUnitTypeDefinition;
var
vSwaggerType: TSwagTypeParameter;
vJson: TJSONObject;
begin
Result := TUnitTypeDefinition.Create;
vSwaggerType := pSwaggerType.TypeParameter;
case vSwaggerType of
stpNotDefined:
begin
if Assigned(pSwaggerType.Schema.JsonSchema.Values['$ref']) then
Result.TypeName := ConvertRefToType(pSwaggerType.Schema.JsonSchema.Values['$ref'].Value)
else
begin
Result.TypeName := pSwaggerType.Schema.JsonSchema.Values['type'].Value;
if Result.TypeName = 'array' then
begin
if Assigned(pSwaggerType.Schema.JsonSchema.Values['items']) then
if Assigned((pSwaggerType.Schema.JsonSchema.Values['items'] as TJSONObject).Values['$ref']) then
Result.TypeName := 'array of ' + ConvertRefToType((pSwaggerType.Schema.JsonSchema.Values['items'] as TJSONObject).Values['$ref'].Value);
end;
end;
end;
stpString: Result.TypeName := 'String';
stpNumber: Result.TypeName := 'Double';
stpInteger: Result.TypeName := 'Integer';
stpBoolean: Result.TypeName := 'Boolean';
stpArray:
begin
vJson := pSwaggerType.Schema.JsonSchema;
if Assigned(vJson) then
begin
OutputDebugString(PChar('TYPE: ' + vJson.ToJson));
Result.TypeName := 'array of ' + pSwaggerType.Schema.JsonSchema.Values['type'].Value;
end
else
begin
if Assigned(pSwaggerType.Items.Values['type']) then
begin
Result.TypeName := 'array of ' + pSwaggerType.Items.Values['type'].Value;
end
else
Result.TypeName := 'array of ';
end;
end;
stpFile: Result.TypeName := 'err File';
end;
end;
function TSwagDocToDelphiRESTClientBuilder.GenerateUnitText(pDelphiUnit: TDelphiUnit): string;
begin
pDelphiUnit.Title := fSwagDoc.Info.Title;
pDelphiUnit.Description := fSwagDoc.Info.Description;
pDelphiUnit.License := fSwagDoc.Info.License.Name;
Result := pDelphiUnit.Generate;
end;
end.

View File

@ -1,868 +0,0 @@
{
"swagger": "2.0",
"info": {
"description": "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.",
"version": "1.0.0",
"title": "Swagger Petstore",
"termsOfService": "http://swagger.io/terms/",
"contact": {
"email": "apiteam@swagger.io"
},
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
}
},
"host": "petstore.swagger.io",
"basePath": "/v2",
"tags": [{
"name": "pet",
"description": "Everything about your Pets",
"externalDocs": {
"description": "Find out more",
"url": "http://swagger.io"
}
},
{
"name": "store",
"description": "Access to Petstore orders"
},
{
"name": "user",
"description": "Operations about user",
"externalDocs": {
"description": "Find out more about our store",
"url": "http://swagger.io"
}
}],
"schemes": ["https",
"http"],
"paths": {
"/pet": {
"post": {
"tags": ["pet"],
"summary": "Add a new pet to the store",
"description": "",
"operationId": "addPet",
"consumes": ["application/json",
"application/xml"],
"produces": ["application/xml",
"application/json"],
"parameters": [{
"in": "body",
"name": "body",
"description": "Pet object that needs to be added to the store",
"required": true,
"schema": {
"$ref": "#/definitions/Pet"
}
}],
"responses": {
"405": {
"description": "Invalid input"
}
},
"security": [{
"petstore_auth": ["write:pets",
"read:pets"]
}]
},
"put": {
"tags": ["pet"],
"summary": "Update an existing pet",
"description": "",
"operationId": "updatePet",
"consumes": ["application/json",
"application/xml"],
"produces": ["application/xml",
"application/json"],
"parameters": [{
"in": "body",
"name": "body",
"description": "Pet object that needs to be added to the store",
"required": true,
"schema": {
"$ref": "#/definitions/Pet"
}
}],
"responses": {
"400": {
"description": "Invalid ID supplied"
},
"404": {
"description": "Pet not found"
},
"405": {
"description": "Validation exception"
}
},
"security": [{
"petstore_auth": ["write:pets",
"read:pets"]
}]
}
},
"/pet/findByStatus": {
"get": {
"tags": ["pet"],
"summary": "Finds Pets by status",
"description": "Multiple status values can be provided with comma separated strings",
"operationId": "findPetsByStatus",
"produces": ["application/xml",
"application/json"],
"parameters": [{
"name": "status",
"in": "query",
"description": "Status values that need to be considered for filter",
"required": true,
"type": "array",
"items": {
"type": "string",
"enum": ["available",
"pending",
"sold"],
"default": "available"
},
"collectionFormat": "multi"
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Pet"
}
}
},
"400": {
"description": "Invalid status value"
}
},
"security": [{
"petstore_auth": ["write:pets",
"read:pets"]
}]
}
},
"/pet/findByTags": {
"get": {
"tags": ["pet"],
"summary": "Finds Pets by tags",
"description": "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.",
"operationId": "findPetsByTags",
"produces": ["application/xml",
"application/json"],
"parameters": [{
"name": "tags",
"in": "query",
"description": "Tags to filter by",
"required": true,
"type": "array",
"items": {
"type": "string"
},
"collectionFormat": "multi"
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Pet"
}
}
},
"400": {
"description": "Invalid tag value"
}
},
"security": [{
"petstore_auth": ["write:pets",
"read:pets"]
}],
"deprecated": true
}
},
"/pet/{petId}": {
"get": {
"tags": ["pet"],
"summary": "Find pet by ID",
"description": "Returns a single pet",
"operationId": "getPetById",
"produces": ["application/xml",
"application/json"],
"parameters": [{
"name": "petId",
"in": "path",
"description": "ID of pet to return",
"required": true,
"type": "integer",
"format": "int64"
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"$ref": "#/definitions/Pet"
}
},
"400": {
"description": "Invalid ID supplied"
},
"404": {
"description": "Pet not found"
}
},
"security": [{
"api_key": []
}]
},
"post": {
"tags": ["pet"],
"summary": "Updates a pet in the store with form data",
"description": "",
"operationId": "updatePetWithForm",
"consumes": ["application/x-www-form-urlencoded"],
"produces": ["application/xml",
"application/json"],
"parameters": [{
"name": "petId",
"in": "path",
"description": "ID of pet that needs to be updated",
"required": true,
"type": "integer",
"format": "int64"
},
{
"name": "name",
"in": "formData",
"description": "Updated name of the pet",
"required": false,
"type": "string"
},
{
"name": "status",
"in": "formData",
"description": "Updated status of the pet",
"required": false,
"type": "string"
}],
"responses": {
"405": {
"description": "Invalid input"
}
},
"security": [{
"petstore_auth": ["write:pets",
"read:pets"]
}]
},
"delete": {
"tags": ["pet"],
"summary": "Deletes a pet",
"description": "",
"operationId": "deletePet",
"produces": ["application/xml",
"application/json"],
"parameters": [{
"name": "api_key",
"in": "header",
"required": false,
"type": "string"
},
{
"name": "petId",
"in": "path",
"description": "Pet id to delete",
"required": true,
"type": "integer",
"format": "int64"
}],
"responses": {
"400": {
"description": "Invalid ID supplied"
},
"404": {
"description": "Pet not found"
}
},
"security": [{
"petstore_auth": ["write:pets",
"read:pets"]
}]
}
},
"/pet/{petId}/uploadImage": {
"post": {
"tags": ["pet"],
"summary": "uploads an image",
"description": "",
"operationId": "uploadFile",
"consumes": ["multipart/form-data"],
"produces": ["application/json"],
"parameters": [{
"name": "petId",
"in": "path",
"description": "ID of pet to update",
"required": true,
"type": "integer",
"format": "int64"
},
{
"name": "additionalMetadata",
"in": "formData",
"description": "Additional data to pass to server",
"required": false,
"type": "string"
},
{
"name": "file",
"in": "formData",
"description": "file to upload",
"required": false,
"type": "file"
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"$ref": "#/definitions/ApiResponse"
}
}
},
"security": [{
"petstore_auth": ["write:pets",
"read:pets"]
}]
}
},
"/store/inventory": {
"get": {
"tags": ["store"],
"summary": "Returns pet inventories by status",
"description": "Returns a map of status codes to quantities",
"operationId": "getInventory",
"produces": ["application/json"],
"parameters": [],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "object",
"additionalProperties": {
"type": "integer",
"format": "int32"
}
}
}
},
"security": [{
"api_key": []
}]
}
},
"/store/order": {
"post": {
"tags": ["store"],
"summary": "Place an order for a pet",
"description": "",
"operationId": "placeOrder",
"produces": ["application/xml",
"application/json"],
"parameters": [{
"in": "body",
"name": "body",
"description": "order placed for purchasing the pet",
"required": true,
"schema": {
"$ref": "#/definitions/Order"
}
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"$ref": "#/definitions/Order"
}
},
"400": {
"description": "Invalid Order"
}
}
}
},
"/store/order/{orderId}": {
"get": {
"tags": ["store"],
"summary": "Find purchase order by ID",
"description": "For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions",
"operationId": "getOrderById",
"produces": ["application/xml",
"application/json"],
"parameters": [{
"name": "orderId",
"in": "path",
"description": "ID of pet that needs to be fetched",
"required": true,
"type": "integer",
"maximum": 10.0,
"minimum": 1.0,
"format": "int64"
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"$ref": "#/definitions/Order"
}
},
"400": {
"description": "Invalid ID supplied"
},
"404": {
"description": "Order not found"
}
}
},
"delete": {
"tags": ["store"],
"summary": "Delete purchase order by ID",
"description": "For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors",
"operationId": "deleteOrder",
"produces": ["application/xml",
"application/json"],
"parameters": [{
"name": "orderId",
"in": "path",
"description": "ID of the order that needs to be deleted",
"required": true,
"type": "integer",
"minimum": 1.0,
"format": "int64"
}],
"responses": {
"400": {
"description": "Invalid ID supplied"
},
"404": {
"description": "Order not found"
}
}
}
},
"/user": {
"post": {
"tags": ["user"],
"summary": "Create user",
"description": "This can only be done by the logged in user.",
"operationId": "createUser",
"produces": ["application/xml",
"application/json"],
"parameters": [{
"in": "body",
"name": "body",
"description": "Created user object",
"required": true,
"schema": {
"$ref": "#/definitions/User"
}
}],
"responses": {
"default": {
"description": "successful operation"
}
}
}
},
"/user/createWithArray": {
"post": {
"tags": ["user"],
"summary": "Creates list of users with given input array",
"description": "",
"operationId": "createUsersWithArrayInput",
"produces": ["application/xml",
"application/json"],
"parameters": [{
"in": "body",
"name": "body",
"description": "List of user object",
"required": true,
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/User"
}
}
}],
"responses": {
"default": {
"description": "successful operation"
}
}
}
},
"/user/createWithList": {
"post": {
"tags": ["user"],
"summary": "Creates list of users with given input array",
"description": "",
"operationId": "createUsersWithListInput",
"produces": ["application/xml",
"application/json"],
"parameters": [{
"in": "body",
"name": "body",
"description": "List of user object",
"required": true,
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/User"
}
}
}],
"responses": {
"default": {
"description": "successful operation"
}
}
}
},
"/user/login": {
"get": {
"tags": ["user"],
"summary": "Logs user into the system",
"description": "",
"operationId": "loginUser",
"produces": ["application/xml",
"application/json"],
"parameters": [{
"name": "username",
"in": "query",
"description": "The user name for login",
"required": true,
"type": "string"
},
{
"name": "password",
"in": "query",
"description": "The password for login in clear text",
"required": true,
"type": "string"
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "string"
},
"headers": {
"X-Rate-Limit": {
"type": "integer",
"format": "int32",
"description": "calls per hour allowed by the user"
},
"X-Expires-After": {
"type": "string",
"format": "date-time",
"description": "date in UTC when token expires"
}
}
},
"400": {
"description": "Invalid username/password supplied"
}
}
}
},
"/user/logout": {
"get": {
"tags": ["user"],
"summary": "Logs out current logged in user session",
"description": "",
"operationId": "logoutUser",
"produces": ["application/xml",
"application/json"],
"parameters": [],
"responses": {
"default": {
"description": "successful operation"
}
}
}
},
"/user/{username}": {
"get": {
"tags": ["user"],
"summary": "Get user by user name",
"description": "",
"operationId": "getUserByName",
"produces": ["application/xml",
"application/json"],
"parameters": [{
"name": "username",
"in": "path",
"description": "The name that needs to be fetched. Use user1 for testing. ",
"required": true,
"type": "string"
}],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"$ref": "#/definitions/User"
}
},
"400": {
"description": "Invalid username supplied"
},
"404": {
"description": "User not found"
}
}
},
"put": {
"tags": ["user"],
"summary": "Updated user",
"description": "This can only be done by the logged in user.",
"operationId": "updateUser",
"produces": ["application/xml",
"application/json"],
"parameters": [{
"name": "username",
"in": "path",
"description": "name that need to be updated",
"required": true,
"type": "string"
},
{
"in": "body",
"name": "body",
"description": "Updated user object",
"required": true,
"schema": {
"$ref": "#/definitions/User"
}
}],
"responses": {
"400": {
"description": "Invalid user supplied"
},
"404": {
"description": "User not found"
}
}
},
"delete": {
"tags": ["user"],
"summary": "Delete user",
"description": "This can only be done by the logged in user.",
"operationId": "deleteUser",
"produces": ["application/xml",
"application/json"],
"parameters": [{
"name": "username",
"in": "path",
"description": "The name that needs to be deleted",
"required": true,
"type": "string"
}],
"responses": {
"400": {
"description": "Invalid username supplied"
},
"404": {
"description": "User not found"
}
}
}
}
},
"securityDefinitions": {
"petstore_auth": {
"type": "oauth2",
"authorizationUrl": "https://petstore.swagger.io/oauth/authorize",
"flow": "implicit",
"scopes": {
"write:pets": "modify pets in your account",
"read:pets": "read your pets"
}
},
"api_key": {
"type": "apiKey",
"name": "api_key",
"in": "header"
}
},
"definitions": {
"Order": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"petId": {
"type": "integer",
"format": "int64"
},
"quantity": {
"type": "integer",
"format": "int32"
},
"shipDate": {
"type": "string",
"format": "date-time"
},
"status": {
"type": "string",
"description": "Order Status",
"enum": ["placed",
"approved",
"delivered"]
},
"complete": {
"type": "boolean",
"default": false
}
},
"xml": {
"name": "Order"
}
},
"User": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"username": {
"type": "string"
},
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"email": {
"type": "string"
},
"password": {
"type": "string"
},
"phone": {
"type": "string"
},
"userStatus": {
"type": "integer",
"format": "int32",
"description": "User Status"
}
},
"xml": {
"name": "User"
}
},
"Category": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
}
},
"xml": {
"name": "Category"
}
},
"Tag": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
}
},
"xml": {
"name": "Tag"
}
},
"Pet": {
"type": "object",
"required": ["name",
"photoUrls"],
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"category": {
"$ref": "#/definitions/Category"
},
"name": {
"type": "string",
"example": "doggie"
},
"photoUrls": {
"type": "array",
"xml": {
"name": "photoUrl",
"wrapped": true
},
"items": {
"type": "string"
}
},
"tags": {
"type": "array",
"xml": {
"name": "tag",
"wrapped": true
},
"items": {
"$ref": "#/definitions/Tag"
}
},
"status": {
"type": "string",
"description": "pet status in the store",
"enum": ["available",
"pending",
"sold"]
}
},
"xml": {
"name": "Pet"
}
},
"ApiResponse": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"type": {
"type": "string"
},
"message": {
"type": "string"
}
}
}
},
"externalDocs": {
"description": "Find out more about Swagger",
"url": "http://swagger.io"
}
}

View File

@ -1,14 +0,0 @@
program LoadSwaggerJsonToObject;
uses
Vcl.Forms,
frmLoadSwaggerJson in 'frmLoadSwaggerJson.pas' {frmSimpleSwaggerDocDemo};
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TfrmSimpleSwaggerDocDemo, frmSimpleSwaggerDocDemo);
Application.Run;
end.

View File

@ -1,629 +0,0 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{4212DAA9-CB1C-4287-9F2D-E5901399D742}</ProjectGuid>
<MainSource>LoadSwaggerJsonToObject.dpr</MainSource>
<Base>True</Base>
<Config Condition="'$(Config)'==''">Debug</Config>
<TargetedPlatforms>1</TargetedPlatforms>
<AppType>Application</AppType>
<FrameworkType>VCL</FrameworkType>
<ProjectVersion>18.6</ProjectVersion>
<Platform Condition="'$(Platform)'==''">Win32</Platform>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
<Base_Win32>true</Base_Win32>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Base)'=='true') or '$(Base_Win64)'!=''">
<Base_Win64>true</Base_Win64>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_1)'!=''">
<Cfg_1>true</Cfg_1>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''">
<Cfg_1_Win32>true</Cfg_1_Win32>
<CfgParent>Cfg_1</CfgParent>
<Cfg_1>true</Cfg_1>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''">
<Cfg_2>true</Cfg_2>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='iOSDevice64' and '$(Cfg_2)'=='true') or '$(Cfg_2_iOSDevice64)'!=''">
<Cfg_2_iOSDevice64>true</Cfg_2_iOSDevice64>
<CfgParent>Cfg_2</CfgParent>
<Cfg_2>true</Cfg_2>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_2)'=='true') or '$(Cfg_2_Win32)'!=''">
<Cfg_2_Win32>true</Cfg_2_Win32>
<CfgParent>Cfg_2</CfgParent>
<Cfg_2>true</Cfg_2>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''">
<DCC_E>false</DCC_E>
<DCC_F>false</DCC_F>
<DCC_K>false</DCC_K>
<DCC_N>false</DCC_N>
<DCC_S>false</DCC_S>
<DCC_ImageBase>00400000</DCC_ImageBase>
<SanitizedProjectName>LoadSwaggerJsonToObject</SanitizedProjectName>
<DCC_Namespace>Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)</DCC_Namespace>
<VerInfo_Locale>1046</VerInfo_Locale>
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=;CFBundleName=</VerInfo_Keys>
<DCC_UnitSearchPath>..\..\Source;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
<DCC_BplOutput>..\..\Lib</DCC_BplOutput>
<DCC_DcuOutput>..\..\Lib</DCC_DcuOutput>
<DCC_DcpOutput>..\..\Lib</DCC_DcpOutput>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win32)'!=''">
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
<BT_BuildType>Debug</BT_BuildType>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName)</VerInfo_Keys>
<VerInfo_Locale>1033</VerInfo_Locale>
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
<UWP_DelphiLogo44>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png</UWP_DelphiLogo44>
<UWP_DelphiLogo150>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png</UWP_DelphiLogo150>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win64)'!=''">
<UWP_DelphiLogo44>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png</UWP_DelphiLogo44>
<UWP_DelphiLogo150>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png</UWP_DelphiLogo150>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1)'!=''">
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
<DCC_DebugInformation>0</DCC_DebugInformation>
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
<AppDPIAwarenessMode>PerMonitor</AppDPIAwarenessMode>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''">
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
<DCC_Optimize>false</DCC_Optimize>
<DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_iOSDevice64)'!=''">
<BT_BuildType>Debug</BT_BuildType>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_Locale>1033</VerInfo_Locale>
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName)</VerInfo_Keys>
<AppDPIAwarenessMode>PerMonitor</AppDPIAwarenessMode>
</PropertyGroup>
<ItemGroup>
<DelphiCompile Include="$(MainSource)">
<MainSource>MainSource</MainSource>
</DelphiCompile>
<DCCReference Include="frmLoadSwaggerJson.pas">
<Form>frmSimpleSwaggerDocDemo</Form>
</DCCReference>
<BuildConfiguration Include="Debug">
<Key>Cfg_2</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
<BuildConfiguration Include="Base">
<Key>Base</Key>
</BuildConfiguration>
<BuildConfiguration Include="Release">
<Key>Cfg_1</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
</ItemGroup>
<ProjectExtensions>
<Borland.Personality>Delphi.Personality.12</Borland.Personality>
<Borland.ProjectType/>
<BorlandProject>
<Delphi.Personality>
<Source>
<Source Name="MainSource">LoadSwaggerJsonToObject.dpr</Source>
</Source>
<Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k250.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dclofficexp250.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
</Excluded_Packages>
</Delphi.Personality>
<Platforms>
<Platform value="iOSDevice64">False</Platform>
<Platform value="Win32">True</Platform>
<Platform value="Win64">False</Platform>
</Platforms>
<Deployment Version="3">
<DeployFile LocalName="LoadSwaggerJsonToObject.exe" Configuration="Debug" Class="ProjectOutput">
<Platform Name="Win32">
<RemoteName>LoadSwaggerJsonToObject.exe</RemoteName>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployClass Name="AdditionalDebugSymbols">
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidClassesDexFile">
<Platform Name="Android">
<RemoteDir>classes</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidFileProvider">
<Platform Name="Android">
<RemoteDir>res\xml</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidGDBServer">
<Platform Name="Android">
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidLibnativeArmeabiFile">
<Platform Name="Android">
<RemoteDir>library\lib\armeabi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidLibnativeMipsFile">
<Platform Name="Android">
<RemoteDir>library\lib\mips</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidServiceOutput">
<Platform Name="Android">
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidSplashImageDef">
<Platform Name="Android">
<RemoteDir>res\drawable</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidSplashStyles">
<Platform Name="Android">
<RemoteDir>res\values</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidSplashStylesV21">
<Platform Name="Android">
<RemoteDir>res\values-v21</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_DefaultAppIcon">
<Platform Name="Android">
<RemoteDir>res\drawable</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon144">
<Platform Name="Android">
<RemoteDir>res\drawable-xxhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon36">
<Platform Name="Android">
<RemoteDir>res\drawable-ldpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon48">
<Platform Name="Android">
<RemoteDir>res\drawable-mdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon72">
<Platform Name="Android">
<RemoteDir>res\drawable-hdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon96">
<Platform Name="Android">
<RemoteDir>res\drawable-xhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_SplashImage426">
<Platform Name="Android">
<RemoteDir>res\drawable-small</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_SplashImage470">
<Platform Name="Android">
<RemoteDir>res\drawable-normal</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_SplashImage640">
<Platform Name="Android">
<RemoteDir>res\drawable-large</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_SplashImage960">
<Platform Name="Android">
<RemoteDir>res\drawable-xlarge</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="DebugSymbols">
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
</DeployClass>
<DeployClass Name="DependencyFramework">
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.framework</Extensions>
</Platform>
<Platform Name="OSX64">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.framework</Extensions>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
</DeployClass>
<DeployClass Name="DependencyModule">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="OSX64">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
<Extensions>.dll;.bpl</Extensions>
</Platform>
</DeployClass>
<DeployClass Required="true" Name="DependencyPackage">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="OSX64">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
<Extensions>.bpl</Extensions>
</Platform>
</DeployClass>
<DeployClass Name="File">
<Platform Name="Android">
<Operation>0</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>0</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>0</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>0</Operation>
</Platform>
<Platform Name="OSX32">
<RemoteDir>Contents\Resources\StartUp\</RemoteDir>
<Operation>0</Operation>
</Platform>
<Platform Name="OSX64">
<RemoteDir>Contents\Resources\StartUp\</RemoteDir>
<Operation>0</Operation>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_Launch1024">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_Launch1536">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_Launch2048">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_Launch768">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Launch320">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Launch640">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Launch640x1136">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectAndroidManifest">
<Platform Name="Android">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSDeviceDebug">
<Platform Name="iOSDevice32">
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSDeviceResourceRules">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSEntitlements">
<Platform Name="iOSDevice32">
<RemoteDir>..\</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<RemoteDir>..\</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSInfoPList">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSResource">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectOSXDebug">
<Platform Name="OSX64">
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectOSXEntitlements">
<Platform Name="OSX32">
<RemoteDir>..\</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="OSX64">
<RemoteDir>..\</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectOSXInfoPList">
<Platform Name="OSX32">
<RemoteDir>Contents</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="OSX64">
<RemoteDir>Contents</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectOSXResource">
<Platform Name="OSX32">
<RemoteDir>Contents\Resources</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="OSX64">
<RemoteDir>Contents\Resources</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Required="true" Name="ProjectOutput">
<Platform Name="Android">
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="Linux64">
<Operation>1</Operation>
</Platform>
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="OSX64">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectUWPManifest">
<Platform Name="Win32">
<Operation>1</Operation>
</Platform>
<Platform Name="Win64">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="UWP_DelphiLogo150">
<Platform Name="Win32">
<RemoteDir>Assets</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Win64">
<RemoteDir>Assets</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="UWP_DelphiLogo44">
<Platform Name="Win32">
<RemoteDir>Assets</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Win64">
<RemoteDir>Assets</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="Linux64" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="OSX32" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="Android" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="OSX64" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>
</Deployment>
</BorlandProject>
<ProjectFileVersion>12</ProjectFileVersion>
</ProjectExtensions>
<Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
<Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
<Import Project="$(MSBuildProjectName).deployproj" Condition="Exists('$(MSBuildProjectName).deployproj')"/>
</Project>

View File

@ -1,47 +0,0 @@
object frmSimpleSwaggerDocDemo: TfrmSimpleSwaggerDocDemo
Left = 0
Top = 0
Caption = 'Load Swagger.json to SwagDoc'
ClientHeight = 214
ClientWidth = 876
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object lblApiDescription: TLabel
Left = 102
Top = 8
Width = 6
Height = 25
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -21
Font.Name = 'Tahoma'
Font.Style = [fsBold]
ParentFont = False
end
object Memo1: TMemo
Left = 0
Top = 39
Width = 876
Height = 175
Align = alBottom
Anchors = [akLeft, akTop, akRight, akBottom]
ScrollBars = ssBoth
TabOrder = 0
end
object btnLoadJSON: TButton
Left = 8
Top = 8
Width = 75
Height = 25
Caption = 'Load JSON'
TabOrder = 1
OnClick = btnLoadJSONClick
end
end

View File

@ -1,64 +0,0 @@
unit frmLoadSwaggerJson;
interface
uses
Winapi.Windows,
Winapi.Messages,
System.SysUtils,
System.Variants,
System.Classes,
Vcl.Graphics,
Vcl.Controls,
Vcl.Forms,
Vcl.Dialogs,
Vcl.StdCtrls,
Swag.Common.Types,
Swag.Doc,
Swag.Doc.Definition,
Swag.Doc.Path,
Swag.Doc.Path.Operation;
type
TfrmSimpleSwaggerDocDemo = class(TForm)
Memo1: TMemo;
btnLoadJSON: TButton;
lblApiDescription: TLabel;
procedure btnLoadJSONClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmSimpleSwaggerDocDemo: TfrmSimpleSwaggerDocDemo;
implementation
{$R *.dfm}
uses
Json.Common.Helpers,
System.IOUtils;
procedure TfrmSimpleSwaggerDocDemo.btnLoadJSONClick(Sender: TObject);
var
vSwagDoc: TSwagDoc;
begin
vSwagDoc := TSwagDoc.Create;
try
vSwagDoc.LoadFromFile('swagger.json');
lblApiDescription.Caption := vSwagDoc.Info.Description;
vSwagDoc.GenerateSwaggerJson;
Memo1.Lines.Clear;
Memo1.Lines.Add(vSwagDoc.SwaggerJson.Format);
finally
FreeAndNil(vSwagDoc);
end;
end;
initialization
ReportMemoryLeaksOnShutdown := True;
end.

View File

@ -1,644 +0,0 @@
{
"swagger":"2.0",
"info":
{
"version":"v1",
"title":"Sample API",
"description":"Sample API Description",
"termsOfService":"http:\/\/www.apache.org\/licenses\/LICENSE-2.0.txt",
"contact":
{
"name":"Marcelo Jaloto",
"email":"marcelojaloto@gmail.com",
"url":"https:\/\/github.com\/marcelojaloto\/SwagDoc"
}
,
"license":
{
"name":"Apache License - Version 2.0, January 2004",
"url":"http:\/\/www.apache.org\/licenses\/LICENSE-2.0"
}
}
,
"host":"localhost",
"basePath":"\/api",
"schemes":
[
"http"
]
,
"consumes":
[
"application\/json"
]
,
"produces":
[
"application\/json"
]
,
"paths":
{
"\/employees":
{
"get":
{
"description":"Returns a employee list.",
"operationId":"{A9A8D343-00EB-402A-8248-94BDA7B6ECD4}",
"tags":
[
"API Employee"
]
,
"responses":
{
"200":
{
"description":"Successfully returns data",
"schema":
{
"type":"object",
"properties":
{
"employees":
{
"type":"array",
"description":"The employee datas.",
"items":
{
"type":"object",
"properties":
{
"employee":
{
"type":"object",
"description":"Employee request data",
"required":
[
"name"
]
,
"properties":
{
"id":
{
"type":"integer",
"description":"The employee identification code.",
"format":"int64"
}
,
"name":
{
"type":"string",
"description":"The employee full name.",
"maxLength":80
}
,
"phone":
{
"type":"string",
"description":"The employee phone number."
}
,
"hireDate":
{
"type":"string",
"description":"The employee hire date.",
"format":"yyyy-MM-dd"
}
,
"salary":
{
"type":"number",
"description":"The employee gross salary."
}
,
"address":
{
"type":"object",
"description":"The employee full address.",
"properties":
{
"description":
{
"type":"string",
"description":"The employee address description."
}
,
"city":
{
"type":"string",
"description":"The employee address city."
}
,
"region":
{
"type":"string",
"description":"The employee address region."
}
,
"country":
{
"type":"string",
"description":"The employee address country."
}
,
"postalCode":
{
"type":"string",
"description":"The employee address postal code."
}
}
}
}
}
}
}
}
}
}
}
}
}
,
"post":
{
"description":"Creates a employee.",
"operationId":"{C450E1E0-341D-4947-A156-9C167BE021D5}",
"tags":
[
"API Employee"
]
,
"parameters":
[
{
"in":"body",
"name":"employee",
"required":true,
"schema":
{
"$ref":"#\/definitions\/employee"
}
}
]
,
"responses":
{
"201":
{
"description":"Successfully creates data",
"schema":
{
"type":"object",
"properties":
{
"employee":
{
"type":"object",
"description":"Employee request data",
"required":
[
"name"
]
,
"properties":
{
"id":
{
"type":"integer",
"description":"The employee identification code.",
"format":"int64"
}
,
"name":
{
"type":"string",
"description":"The employee full name.",
"maxLength":80
}
,
"phone":
{
"type":"string",
"description":"The employee phone number."
}
,
"hireDate":
{
"type":"string",
"description":"The employee hire date.",
"format":"yyyy-MM-dd"
}
,
"salary":
{
"type":"number",
"description":"The employee gross salary."
}
,
"address":
{
"type":"object",
"description":"The employee full address.",
"properties":
{
"description":
{
"type":"string",
"description":"The employee address description."
}
,
"city":
{
"type":"string",
"description":"The employee address city."
}
,
"region":
{
"type":"string",
"description":"The employee address region."
}
,
"country":
{
"type":"string",
"description":"The employee address country."
}
,
"postalCode":
{
"type":"string",
"description":"The employee address postal code."
}
}
}
}
}
}
}
}
}
}
}
,
"\/employees\/{id}":
{
"get":
{
"description":"Returns a employee.",
"operationId":"{2DDE05B6-C01A-4EB8-B7CD-2041C51C97C7}",
"tags":
[
"API Employee"
]
,
"parameters":
[
{
"in":"path",
"name":"id",
"required":true,
"type":"integer"
}
]
,
"responses":
{
"200":
{
"description":"Successfully returns data",
"schema":
{
"type":"object",
"properties":
{
"employee":
{
"type":"object",
"description":"Employee request data",
"required":
[
"name"
]
,
"properties":
{
"id":
{
"type":"integer",
"description":"The employee identification code.",
"format":"int64"
}
,
"name":
{
"type":"string",
"description":"The employee full name.",
"maxLength":80
}
,
"phone":
{
"type":"string",
"description":"The employee phone number."
}
,
"hireDate":
{
"type":"string",
"description":"The employee hire date.",
"format":"yyyy-MM-dd"
}
,
"salary":
{
"type":"number",
"description":"The employee gross salary."
}
,
"address":
{
"type":"object",
"description":"The employee full address.",
"properties":
{
"description":
{
"type":"string",
"description":"The employee address description."
}
,
"city":
{
"type":"string",
"description":"The employee address city."
}
,
"region":
{
"type":"string",
"description":"The employee address region."
}
,
"country":
{
"type":"string",
"description":"The employee address country."
}
,
"postalCode":
{
"type":"string",
"description":"The employee address postal code."
}
}
}
}
}
}
}
}
}
}
,
"put":
{
"description":"Updates a employee.",
"operationId":"{28E989FB-0225-40BD-A97E-8D1EA80D09AF}",
"tags":
[
"API Employee"
]
,
"parameters":
[
{
"in":"path",
"name":"id",
"required":true,
"type":"integer"
}
,
{
"in":"body",
"name":"employee",
"required":true,
"schema":
{
"$ref":"#\/definitions\/employee"
}
}
]
,
"responses":
{
"200":
{
"description":"Successfully updates data",
"schema":
{
"type":"object",
"properties":
{
"employee":
{
"type":"object",
"description":"Employee request data",
"required":
[
"name"
]
,
"properties":
{
"id":
{
"type":"integer",
"description":"The employee identification code.",
"format":"int64"
}
,
"name":
{
"type":"string",
"description":"The employee full name.",
"maxLength":80
}
,
"phone":
{
"type":"string",
"description":"The employee phone number."
}
,
"hireDate":
{
"type":"string",
"description":"The employee hire date.",
"format":"yyyy-MM-dd"
}
,
"salary":
{
"type":"number",
"description":"The employee gross salary."
}
,
"address":
{
"type":"object",
"description":"The employee full address.",
"properties":
{
"description":
{
"type":"string",
"description":"The employee address description."
}
,
"city":
{
"type":"string",
"description":"The employee address city."
}
,
"region":
{
"type":"string",
"description":"The employee address region."
}
,
"country":
{
"type":"string",
"description":"The employee address country."
}
,
"postalCode":
{
"type":"string",
"description":"The employee address postal code."
}
}
}
}
}
}
}
}
}
}
,
"delete":
{
"description":"Deletes a employee.",
"operationId":"{F47F38F3-2B99-4481-AFDD-ECD89893FEA0}",
"tags":
[
"API Employee"
]
,
"parameters":
[
{
"in":"path",
"name":"id",
"required":true,
"type":"integer"
}
]
,
"responses":
{
"204":
{
"description":"Successfully deletes data"
}
}
}
}
}
,
"definitions":
{
"employee":
{
"type":"object",
"description":"Employee response data",
"required":
[
"name"
]
,
"properties":
{
"name":
{
"type":"string",
"description":"The employee full name.",
"maxLength":80
}
,
"phone":
{
"type":"string",
"description":"The employee phone number."
}
,
"hireDate":
{
"type":"string",
"description":"The employee hire date.",
"format":"yyyy-MM-dd"
}
,
"salary":
{
"type":"number",
"description":"The employee gross salary."
}
,
"address":
{
"type":"object",
"description":"The employee full address.",
"properties":
{
"description":
{
"type":"string",
"description":"The employee address description."
}
,
"city":
{
"type":"string",
"description":"The employee address city."
}
,
"region":
{
"type":"string",
"description":"The employee address region."
}
,
"country":
{
"type":"string",
"description":"The employee address country."
}
,
"postalCode":
{
"type":"string",
"description":"The employee address postal code."
}
}
}
}
}
}
}

View File

@ -1,354 +0,0 @@
{ }
{******************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{******************************************************************************}
unit Sample.Api.Employee;
interface
uses
System.JSON,
Json.Schema,
Swag.Doc,
Swag.Doc.Definition,
Swag.Doc.Path,
Swag.Doc.Path.Operation,
Swag.Doc.Path.Operation.RequestParameter,
Swag.Doc.Path.Operation.Response;
type
TFakeApiEmployee = class(TObject)
strict private
const c_EmployeeTagName = 'API Employee';
const c_EmployeeSchemaName = 'employee';
///const c_EmployeeSchemaNameResponse = 'employeeResponse';
const c_ParameterEmployeeId = 'id';
function DocumentGetEmployeesList: TSwagPathOperation;
function DocumentGetEmployee: TSwagPathOperation;
function DocumentPostEmployee: TSwagPathOperation;
function DocumentPutEmployee: TSwagPathOperation;
function DocumentDeleteEmployee: TSwagPathOperation;
function DocumentRequestParameterEmployeeId: TSwagRequestParameter;
function DocumentRequestBodyEmployee: TSwagRequestParameter;
function DocumentEmployeeModelSchema: TJsonSchema;
function DocumentEmployeeResponseSchema: TJsonSchema;
function DocumentEmployeesListResponseSchema: TJsonSchema;
function CreatePath(const pRoute: string; pOperations: array of TSwagPathOperation): TSwagPath;
function CreateModel(const pSchemaName: string; pJsonSchema: TJsonObject): TSwagDefinition;
function CreateResponse(const pStatusCode, pDescription: string; pJsonSchema: TJsonObject): TSwagResponse;
function ExtractJsonFromSchema(pSchema: TJsonSchema): TJsonObject;
public
{$REGION 'Fake API Methods'}
// POST /api/employees
procedure AddEmployee;
// GET /api/employees
procedure GetEmployees;
// GET /api/employees/{id}
procedure GetEmployee(const pId: Int64);
// PUT /api/employees/{id}
procedure UpdateEmployee(const pId: Int64);
// DELETE /api/employees/{id}
procedure DeleteEmployee(const pId: Int64);
{$ENDREGION}
procedure DocumentApi(pSwagDoc: TSwagDoc);
end;
implementation
uses
Json.Schema.Field.Strings,
Json.Schema.Field.Arrays,
Json.Schema.Field.Enums,
Swag.Common.Types;
{ TApiEmployee }
{$REGION 'Fake methods not implemented'}
procedure TFakeApiEmployee.AddEmployee;
begin
{ TODO : Fake method not implemented }
end;
procedure TFakeApiEmployee.GetEmployee(const pId: Int64);
begin
{ TODO : Fake method not implemented }
end;
procedure TFakeApiEmployee.GetEmployees;
begin
{ TODO : Fake method not implemented }
end;
procedure TFakeApiEmployee.UpdateEmployee(const pId: Int64);
begin
{ TODO : Fake method not implemented }
end;
procedure TFakeApiEmployee.DeleteEmployee(const pId: Int64);
begin
{ TODO : Fake method not implemented }
end;
{$ENDREGION}
procedure TFakeApiEmployee.DocumentApi(pSwagDoc: TSwagDoc);
var
vRoute: TSwagPath;
vModel: TSwagDefinition;
begin
vModel := CreateModel(c_EmployeeSchemaName, ExtractJsonFromSchema(DocumentEmployeeModelSchema));
pSwagDoc.Definitions.Add(vModel);
///vModel := CreateModel(c_EmployeeSchemaNameResponse, ExtractJsonFromSchema(DocumentEmployeeResponseSchema));
///pSwagDoc.Definitions.Add(vModel);
vRoute := CreatePath('/employees',
[DocumentGetEmployeesList,
DocumentPostEmployee]);
pSwagDoc.Paths.Add(vRoute);
vRoute := CreatePath('/employees/{' + c_ParameterEmployeeId + '}',
[DocumentGetEmployee,
DocumentPutEmployee,
DocumentDeleteEmployee]);
pSwagDoc.Paths.Add(vRoute);
end;
function TFakeApiEmployee.CreateModel(const pSchemaName: string; pJsonSchema: TJsonObject): TSwagDefinition;
begin
Result := TSwagDefinition.Create;
Result.Name := pSchemaName;
Result.JsonSchema := pJsonSchema;
end;
function TFakeApiEmployee.DocumentEmployeeModelSchema: TJsonSchema;
var
vName: TJsonFieldString;
vAddressSchema: TJsonSchema;
vGender: TJsonFieldEnum;
begin
Result := TJsonSchema.Create;
Result.Root.Description := 'Employee response data';
vName := TJsonFieldString(Result.AddField<string>('name', 'The employee full name.'));
vName.Required := True;
vName.MaxLength := 80;
Result.AddField<string>('phone', 'The employee phone number.');
Result.AddField<TDate>('hireDate', 'The employee hire date.');
Result.AddField<Double>('salary', 'The employee gross salary.');
vGender := Result.AddFieldAsType<TJsonFieldEnum>('gender', 'The employee gender.');
vGender.Required := True;
vGender.EnumType := etString;
vGender.AddItems(['male', 'female']);
vAddressSchema := TJsonSchema.Create;
try
vAddressSchema.Root.Name := 'address';
vAddressSchema.Root.Description := 'The employee full address.';
vAddressSchema.AddField<string>('description', 'The employee address description.');
vAddressSchema.AddField<string>('city', 'The employee address city.');
vAddressSchema.AddField<string>('region', 'The employee address region.');
vAddressSchema.AddField<string>('country', 'The employee address country.');
vAddressSchema.AddField<string>('postalCode', 'The employee address postal code.');
Result.AddField(vAddressSchema);
finally
vAddressSchema.Free;
end;
end;
function TFakeApiEmployee.DocumentEmployeeResponseSchema: TJsonSchema;
var
vSchema: TJsonSchema;
vSchemaEmployeeModel: TJsonSchema;
begin
vSchema := TJsonSchema.Create;
try
vSchema.Root.Name := 'employee';
vSchema.Root.Description := 'Employee request data';
vSchema.AddField<Int64>('id', 'The employee identification code.');
vSchemaEmployeeModel := DocumentEmployeeModelSchema;
try
vSchema.Root.CopyFields(vSchemaEmployeeModel.Root);
finally
vSchemaEmployeeModel.Free;
end;
Result := TJsonSchema.Create;
Result.AddField(vSchema);
finally
vSchema.Free;
end;
end;
function TFakeApiEmployee.DocumentEmployeesListResponseSchema: TJsonSchema;
var
vSchema: TJsonSchema;
vFieldArray: TJsonFieldArray;
begin
vSchema := DocumentEmployeeResponseSchema;
try
Result := TJsonSchema.Create;
vFieldArray := TJsonFieldArray(Result.AddField<TJsonFieldArray>('employees', 'The employee datas.'));
vFieldArray.ItemFieldType := vSchema.Root.Clone;
finally
vSchema.Free;
end;
end;
function TFakeApiEmployee.DocumentGetEmployee: TSwagPathOperation;
var
vResponse: TSwagResponse;
vResponseJson: TJsonObject;
begin
vResponseJson := ExtractJsonFromSchema(DocumentEmployeeResponseSchema);
vResponse := CreateResponse('200', 'Successfully returns data', vResponseJson);
Result := TSwagPathOperation.Create;
Result.Operation := ohvGet;
Result.OperationId := '{2DDE05B6-C01A-4EB8-B7CD-2041C51C97C7}';
Result.Description := 'Returns a employee.';
Result.Parameters.Add(DocumentRequestParameterEmployeeId);
Result.Responses.Add('200', vResponse);
Result.Tags.Add(c_EmployeeTagName);
end;
function TFakeApiEmployee.DocumentGetEmployeesList: TSwagPathOperation;
var
vResponse: TSwagResponse;
vResponseJson: TJsonObject;
begin
vResponseJson := ExtractJsonFromSchema(DocumentEmployeesListResponseSchema);
vResponse := CreateResponse('200', 'Successfully returns data', vResponseJson);
Result := TSwagPathOperation.Create;
Result.Operation := ohvGet;
Result.OperationId := '{A9A8D343-00EB-402A-8248-94BDA7B6ECD4}';
Result.Description := 'Returns a employee list.';
Result.Responses.Add('200', vResponse);
Result.Tags.Add(c_EmployeeTagName);
end;
function TFakeApiEmployee.DocumentPostEmployee: TSwagPathOperation;
var
vResponse: TSwagResponse;
vResponseJson: TJsonObject;
begin
vResponseJson := ExtractJsonFromSchema(DocumentEmployeeResponseSchema);
vResponse := CreateResponse('201', 'Successfully creates data', vResponseJson);
Result := TSwagPathOperation.Create;
Result.Operation := ohvPost;
Result.OperationId := '{C450E1E0-341D-4947-A156-9C167BE021D5}';
Result.Description := 'Creates a employee.';
Result.Parameters.Add(DocumentRequestBodyEmployee);
Result.Responses.Add('201', vResponse);
Result.Tags.Add(c_EmployeeTagName);
end;
function TFakeApiEmployee.DocumentPutEmployee: TSwagPathOperation;
var
vResponse: TSwagResponse;
vResponseJson: TJsonObject;
begin
vResponseJson := ExtractJsonFromSchema(DocumentEmployeeResponseSchema);
vResponse := CreateResponse('200', 'Successfully updates data', vResponseJson);
Result := TSwagPathOperation.Create;
Result.Operation := ohvPut;
Result.OperationId := '{28E989FB-0225-40BD-A97E-8D1EA80D09AF}';
Result.Description := 'Updates a employee.';
Result.Parameters.Add(DocumentRequestParameterEmployeeId);
Result.Parameters.Add(DocumentRequestBodyEmployee);
Result.Responses.Add('200', vResponse);
Result.Tags.Add(c_EmployeeTagName);
end;
function TFakeApiEmployee.DocumentDeleteEmployee: TSwagPathOperation;
var
vResponse: TSwagResponse;
begin
vResponse := CreateResponse('204', 'Successfully deletes data', nil);
Result := TSwagPathOperation.Create;
Result.Operation := ohvDelete;
Result.OperationId := '{F47F38F3-2B99-4481-AFDD-ECD89893FEA0}';
Result.Description := 'Deletes a employee.';
Result.Parameters.Add(DocumentRequestParameterEmployeeId);
Result.Responses.Add('204', vResponse);
Result.Tags.Add(c_EmployeeTagName);
end;
function TFakeApiEmployee.CreateResponse(const pStatusCode, pDescription: string;
pJsonSchema: TJsonObject): TSwagResponse;
begin
Result := TSwagResponse.Create;
Result.StatusCode := pStatusCode;
Result.Description := pDescription;
///vResponse.Schema.Name := c_EmployeeSchemaNameResponse;
if Assigned(pJsonSchema) then
Result.Schema.JsonSchema := pJsonSchema;
end;
function TFakeApiEmployee.CreatePath(const pRoute: string; pOperations: array of TSwagPathOperation): TSwagPath;
var
vOperation: TSwagPathOperation;
begin
Result := TSwagPath.Create;
Result.Uri := pRoute;
for vOperation in pOperations do
Result.Operations.Add(vOperation);
end;
function TFakeApiEmployee.DocumentRequestBodyEmployee: TSwagRequestParameter;
begin
Result := TSwagRequestParameter.Create;
Result.Name := 'employee';
Result.InLocation := rpiBody;
Result.Required := True;
Result.Schema.Name := c_EmployeeSchemaName;
end;
function TFakeApiEmployee.DocumentRequestParameterEmployeeId: TSwagRequestParameter;
begin
Result := TSwagRequestParameter.Create;
Result.Name := c_ParameterEmployeeId;
Result.InLocation := rpiPath;
Result.Required := True;
Result.TypeParameter := stpInteger;
end;
function TFakeApiEmployee.ExtractJsonFromSchema(pSchema: TJsonSchema): TJsonObject;
begin
try
Result := pSchema.ToJson;
finally
pSchema.Free;
end;
end;
end.

View File

@ -1,40 +0,0 @@
{ }
{******************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{******************************************************************************}
unit Sample.Data.Address;
interface
type
TAddress = class(TObject)
private
fPostalCode: string;
fCountry: string;
fDescription: string;
fCity: string;
fRegion: string;
public
property Description: string read fDescription write fDescription;
property City: string read fCity write fCity;
property Region: string read fRegion write fRegion;
property Country: string read fCountry write fCountry;
property PostalCode: string read fPostalCode write fPostalCode;
end;
implementation
end.

View File

@ -1,45 +0,0 @@
{ }
{******************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{******************************************************************************}
unit Sample.Data.Employee;
interface
uses
Sample.Data.Address;
type
TEmployee = class(TObject)
strict private
fName: String;
fHireDate: TDate;
fPhone: String;
fId: Int64;
fSalary: Double;
fAddress: TAddress;
public
property Id: Int64 read fId write fId;
property Name: String read fName write fName;
property Phone: String read fPhone write fPhone;
property HireDate: TDate read fHireDate write fHireDate;
property Salary: Double read fSalary write fSalary;
property Address: TAddress read fAddress write fAddress;
end;
implementation
end.

View File

@ -1,31 +0,0 @@
object Form1: TForm1
Left = 0
Top = 0
Caption = 'Sample Api with Documentation Swagger using SwagDoc'
ClientHeight = 685
ClientWidth = 605
FormFactor.Width = 320
FormFactor.Height = 480
FormFactor.Devices = [Desktop]
DesignerMasterStyle = 0
object Button1: TButton
Position.X = 16.000000000000000000
Position.Y = 8.000000000000000000
TabOrder = 1
Text = 'Generate'
OnClick = Button1Click
end
object Memo1: TMemo
Touch.InteractiveGestures = [Pan, LongTap, DoubleTap]
DataDetectorTypes = []
Anchors = [akLeft, akTop, akRight, akBottom]
Position.X = 16.000000000000000000
Position.Y = 40.000000000000000000
Size.Width = 574.000000000000000000
Size.Height = 630.000000000000000000
Size.PlatformDefault = False
TabOrder = 2
Viewport.Width = 570.000000000000000000
Viewport.Height = 626.000000000000000000
end
end

View File

@ -1,78 +0,0 @@
{******************************************************************************}
{ }
{ Delphi SwagDoc Library }
{ Copyright (c) 2018 Marcelo Jaloto }
{ https://github.com/marcelojaloto/SwagDoc }
{ }
{******************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{******************************************************************************}
unit Sample.Main;
interface
uses
System.SysUtils,
System.Types,
System.UITypes,
System.Classes,
System.Variants,
FMX.Types,
FMX.Controls,
FMX.Forms,
FMX.Graphics,
FMX.Dialogs,
FMX.Controls.Presentation,
FMX.StdCtrls, FMX.ScrollBox, FMX.Memo;
type
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.fmx}
uses
Sample.SwagDoc;
procedure TForm1.Button1Click(Sender: TObject);
var
vSampleDocApi: TSampleApiSwagDocBuilder;
begin
vSampleDocApi := TSampleApiSwagDocBuilder.Create;
try
vSampleDocApi.DeployFolder := ExtractFilePath(ParamStr(0));
memo1.Lines.Text := vSampleDocApi.Generate;
finally
vSampleDocApi.Free;
end;
end;
initialization
ReportMemoryLeaksOnShutdown := True;
end.

View File

@ -1,120 +0,0 @@
{ }
{******************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{******************************************************************************}
unit Sample.SwagDoc;
interface
uses
Swag.Doc;
type
TSampleApiSwagDocBuilder = class(TObject)
strict private
fSwagDoc: TSwagDoc;
fDeployFolder: string;
procedure DocumentApiInfo;
procedure DocumentApiSettings;
procedure DocumentApi;
procedure DocumentApiEmployee;
procedure SaveSwaggerJson;
private
procedure SetDeployFolder(const Value: string);
public
function Generate: string;
property DeployFolder: string read fDeployFolder write SetDeployFolder;
end;
implementation
uses
Json.Common.Helpers,
Swag.Common.Types,
Sample.Api.Employee;
{ TSampleApiSwagDocBuilder }
function TSampleApiSwagDocBuilder.Generate: string;
begin
fSwagDoc := TSwagDoc.Create;
try
DocumentApiInfo;
DocumentApiSettings;
DocumentApi;
fSwagDoc.GenerateSwaggerJson;
SaveSwaggerJson;
Result := fSwagDoc.SwaggerJson.Format;
finally
fSwagDoc.Free;
end;
end;
procedure TSampleApiSwagDocBuilder.DocumentApiInfo;
begin
fSwagDoc.Info.Title := 'Sample API';
fSwagDoc.Info.Version := 'v1';
fSwagDoc.Info.TermsOfService := 'http://www.apache.org/licenses/LICENSE-2.0.txt';
fSwagDoc.Info.Description := 'Sample API Description';
fSwagDoc.Info.Contact.Name := 'Marcelo Jaloto';
fSwagDoc.Info.Contact.Email := 'marcelojaloto@gmail.com';
fSwagDoc.Info.Contact.Url := 'https://github.com/marcelojaloto/SwagDoc';
fSwagDoc.Info.License.Name := 'Apache License - Version 2.0, January 2004';
fSwagDoc.Info.License.Url := 'http://www.apache.org/licenses/LICENSE-2.0';
end;
procedure TSampleApiSwagDocBuilder.DocumentApiSettings;
begin
fSwagDoc.Host := 'localhost';
fSwagDoc.BasePath := '/api';
fSwagDoc.Consumes.Add('application/json');
fSwagDoc.Produces.Add('application/json');
fSwagDoc.Schemes := [tpsHttp];
end;
procedure TSampleApiSwagDocBuilder.DocumentApi;
begin
DocumentApiEmployee;
end;
procedure TSampleApiSwagDocBuilder.DocumentApiEmployee;
var
vApiEmployee: TFakeApiEmployee;
begin
vApiEmployee := TFakeApiEmployee.Create;
try
vApiEmployee.DocumentApi(fSwagDoc);
finally
vApiEmployee.Free;
end;
end;
procedure TSampleApiSwagDocBuilder.SaveSwaggerJson;
begin
fSwagDoc.SwaggerFilesFolder := fDeployFolder;
fSwagDoc.SaveSwaggerJsonToFile;
end;
procedure TSampleApiSwagDocBuilder.SetDeployFolder(const Value: string);
begin
fDeployFolder := Value;
end;
end.

View File

@ -1,18 +0,0 @@
program SampleApi;
uses
System.StartUpCopy,
FMX.Forms,
Sample.Main in 'Sample.Main.pas' {Form1},
Sample.Data.Employee in 'Sample.Data.Employee.pas',
Sample.SwagDoc in 'Sample.SwagDoc.pas',
Sample.Api.Employee in 'Sample.Api.Employee.pas',
Sample.Data.Address in 'Sample.Data.Address.pas';
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

View File

@ -1,924 +0,0 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{B07537E3-021C-4905-B342-7B3332F81692}</ProjectGuid>
<ProjectVersion>18.6</ProjectVersion>
<FrameworkType>FMX</FrameworkType>
<MainSource>SampleApi.dpr</MainSource>
<Base>True</Base>
<Config Condition="'$(Config)'==''">Debug</Config>
<Platform Condition="'$(Platform)'==''">Win32</Platform>
<TargetedPlatforms>1</TargetedPlatforms>
<AppType>Application</AppType>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Android' and '$(Base)'=='true') or '$(Base_Android)'!=''">
<Base_Android>true</Base_Android>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='iOSDevice32' and '$(Base)'=='true') or '$(Base_iOSDevice32)'!=''">
<Base_iOSDevice32>true</Base_iOSDevice32>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='iOSDevice64' and '$(Base)'=='true') or '$(Base_iOSDevice64)'!=''">
<Base_iOSDevice64>true</Base_iOSDevice64>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='iOSSimulator' and '$(Base)'=='true') or '$(Base_iOSSimulator)'!=''">
<Base_iOSSimulator>true</Base_iOSSimulator>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='OSX32' and '$(Base)'=='true') or '$(Base_OSX32)'!=''">
<Base_OSX32>true</Base_OSX32>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
<Base_Win32>true</Base_Win32>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Base)'=='true') or '$(Base_Win64)'!=''">
<Base_Win64>true</Base_Win64>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">
<Cfg_1>true</Cfg_1>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''">
<Cfg_1_Win32>true</Cfg_1_Win32>
<CfgParent>Cfg_1</CfgParent>
<Cfg_1>true</Cfg_1>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win64)'!=''">
<Cfg_1_Win64>true</Cfg_1_Win64>
<CfgParent>Cfg_1</CfgParent>
<Cfg_1>true</Cfg_1>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
<Cfg_2>true</Cfg_2>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_2)'=='true') or '$(Cfg_2_Win32)'!=''">
<Cfg_2_Win32>true</Cfg_2_Win32>
<CfgParent>Cfg_2</CfgParent>
<Cfg_2>true</Cfg_2>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Cfg_2)'=='true') or '$(Cfg_2_Win64)'!=''">
<Cfg_2_Win64>true</Cfg_2_Win64>
<CfgParent>Cfg_2</CfgParent>
<Cfg_2>true</Cfg_2>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''">
<DCC_DcuOutput>.\$(Platform)\$(Config)</DCC_DcuOutput>
<DCC_ExeOutput>.\$(Platform)\$(Config)</DCC_ExeOutput>
<DCC_E>false</DCC_E>
<DCC_N>false</DCC_N>
<DCC_S>false</DCC_S>
<DCC_F>false</DCC_F>
<DCC_K>false</DCC_K>
<DCC_UsePackage>RESTComponents;FireDAC;FireDACSqliteDriver;soaprtl;FireDACIBDriver;soapmidas;FireDACCommon;RESTBackendComponents;soapserver;CloudService;FireDACCommonDriver;inet;$(DCC_UsePackage)</DCC_UsePackage>
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)</DCC_Namespace>
<AUP_ACCESS_COARSE_LOCATION>true</AUP_ACCESS_COARSE_LOCATION>
<AUP_ACCESS_FINE_LOCATION>true</AUP_ACCESS_FINE_LOCATION>
<AUP_CALL_PHONE>true</AUP_CALL_PHONE>
<AUP_CAMERA>true</AUP_CAMERA>
<AUP_INTERNET>true</AUP_INTERNET>
<AUP_READ_CALENDAR>true</AUP_READ_CALENDAR>
<AUP_READ_EXTERNAL_STORAGE>true</AUP_READ_EXTERNAL_STORAGE>
<AUP_WRITE_CALENDAR>true</AUP_WRITE_CALENDAR>
<AUP_WRITE_EXTERNAL_STORAGE>true</AUP_WRITE_EXTERNAL_STORAGE>
<AUP_READ_PHONE_STATE>true</AUP_READ_PHONE_STATE>
<Icon_MainIcon>$(BDS)\bin\delphi_PROJECTICON.ico</Icon_MainIcon>
<Icns_MainIcns>$(BDS)\bin\delphi_PROJECTICNS.icns</Icns_MainIcns>
<SanitizedProjectName>SampleApi</SanitizedProjectName>
<DCC_UnitSearchPath>..\..\Source;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
<VerInfo_Locale>1046</VerInfo_Locale>
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Android)'!=''">
<DCC_UsePackage>DBXSqliteDriver;IndyIPCommon;bindcompdbx;DBXInterBaseDriver;IndyIPServer;IndySystem;tethering;fmxFireDAC;bindcompfmx;FMXTee;DbxCommonDriver;FmxTeeUI;fmx;xmlrtl;rtl;DbxClientDriver;CustomIPTransport;dbexpress;IndyCore;bindcomp;dsnap;IndyIPClient;dbxcds;bindengine;dsnapxml;dbrtl;IndyProtocols;$(DCC_UsePackage)</DCC_UsePackage>
<VerInfo_Keys>package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=</VerInfo_Keys>
<BT_BuildType>Debug</BT_BuildType>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<Android_LauncherIcon36>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_36x36.png</Android_LauncherIcon36>
<Android_LauncherIcon48>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_48x48.png</Android_LauncherIcon48>
<Android_LauncherIcon72>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png</Android_LauncherIcon72>
<Android_LauncherIcon96>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_96x96.png</Android_LauncherIcon96>
<Android_LauncherIcon144>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_144x144.png</Android_LauncherIcon144>
<Android_SplashImage426>$(BDS)\bin\Artwork\Android\FM_SplashImage_426x320.png</Android_SplashImage426>
<Android_SplashImage470>$(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png</Android_SplashImage470>
<Android_SplashImage640>$(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png</Android_SplashImage640>
<Android_SplashImage960>$(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png</Android_SplashImage960>
<EnabledSysJars>android-support-v4.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services-ads-7.0.0.dex.jar;google-play-services-analytics-7.0.0.dex.jar;google-play-services-base-7.0.0.dex.jar;google-play-services-gcm-7.0.0.dex.jar;google-play-services-identity-7.0.0.dex.jar;google-play-services-maps-7.0.0.dex.jar;google-play-services-panorama-7.0.0.dex.jar;google-play-services-plus-7.0.0.dex.jar;google-play-services-wallet-7.0.0.dex.jar</EnabledSysJars>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_iOSDevice32)'!=''">
<DCC_UsePackage>DBXSqliteDriver;IndyIPCommon;bindcompdbx;DBXInterBaseDriver;IndyIPServer;IndySystem;tethering;fmxFireDAC;bindcompfmx;FMXTee;DbxCommonDriver;FmxTeeUI;fmx;xmlrtl;rtl;DbxClientDriver;CustomIPTransport;dbexpress;IndyCore;bindcomp;dsnap;IndyIPClient;dbxcds;bindengine;dsnapxml;dbrtl;IndyProtocols;fmxase;$(DCC_UsePackage)</DCC_UsePackage>
<VerInfo_Keys>CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0;CFBundleShortVersionString=1.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone &amp; iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=;NSContactsUsageDescription=The reason for accessing the contacts;NSPhotoLibraryUsageDescription=The reason for accessing the photo library;NSCameraUsageDescription=The reason for accessing the camera</VerInfo_Keys>
<VerInfo_UIDeviceFamily>iPhoneAndiPad</VerInfo_UIDeviceFamily>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<BT_BuildType>Debug</BT_BuildType>
<VerInfo_BundleId>$(MSBuildProjectName)</VerInfo_BundleId>
<iPhone_AppIcon57>$(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_57x57.png</iPhone_AppIcon57>
<iPhone_AppIcon60>$(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png</iPhone_AppIcon60>
<iPhone_AppIcon87>$(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_87x87.png</iPhone_AppIcon87>
<iPhone_AppIcon114>$(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_114x114.png</iPhone_AppIcon114>
<iPhone_AppIcon120>$(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png</iPhone_AppIcon120>
<iPhone_AppIcon180>$(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_180x180.png</iPhone_AppIcon180>
<iPhone_Launch320>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_320x480.png</iPhone_Launch320>
<iPhone_Launch640>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_640x960.png</iPhone_Launch640>
<iPhone_Launch640x1136>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_640x1136.png</iPhone_Launch640x1136>
<iPhone_Launch750>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_750x1334.png</iPhone_Launch750>
<iPhone_Launch1242>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_1242x2208.png</iPhone_Launch1242>
<iPhone_Launch2208>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_2208x1242.png</iPhone_Launch2208>
<iPhone_Launch1125>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_1125x2436.png</iPhone_Launch1125>
<iPhone_Launch2436>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_2436x1125.png</iPhone_Launch2436>
<iPhone_Spotlight29>$(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_29x29.png</iPhone_Spotlight29>
<iPhone_Spotlight40>$(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png</iPhone_Spotlight40>
<iPhone_Spotlight58>$(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_58x58.png</iPhone_Spotlight58>
<iPhone_Spotlight80>$(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png</iPhone_Spotlight80>
<iPad_AppIcon72>$(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_72x72.png</iPad_AppIcon72>
<iPad_AppIcon76>$(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png</iPad_AppIcon76>
<iPad_AppIcon144>$(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_144x144.png</iPad_AppIcon144>
<iPad_AppIcon152>$(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png</iPad_AppIcon152>
<iPad_Launch768>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1004.png</iPad_Launch768>
<iPad_Launch768x1024>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png</iPad_Launch768x1024>
<iPad_Launch1024>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x748.png</iPad_Launch1024>
<iPad_Launch1024x768>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png</iPad_Launch1024x768>
<iPad_Launch1536>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2008.png</iPad_Launch1536>
<iPad_Launch1536x2048>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png</iPad_Launch1536x2048>
<iPad_Launch2048>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1496.png</iPad_Launch2048>
<iPad_Launch2048x1536>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png</iPad_Launch2048x1536>
<iPad_SpotLight40>$(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png</iPad_SpotLight40>
<iPad_SpotLight50>$(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_50x50.png</iPad_SpotLight50>
<iPad_SpotLight80>$(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png</iPad_SpotLight80>
<iPad_SpotLight100>$(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_100x100.png</iPad_SpotLight100>
<iPad_Setting29>$(BDS)\bin\Artwork\iOS\iPad\FM_SettingIcon_29x29.png</iPad_Setting29>
<iPad_Setting58>$(BDS)\bin\Artwork\iOS\iPad\FM_SettingIcon_58x58.png</iPad_Setting58>
<iPhone_Spotlight120>$(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_120x120.png</iPhone_Spotlight120>
<iPhone_Launch828>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_828x1792.png</iPhone_Launch828>
<iPhone_Launch1136x640>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_1136x640.png</iPhone_Launch1136x640>
<iPhone_Launch1242x2688>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_1242x2688.png</iPhone_Launch1242x2688>
<iPhone_Launch1334>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_1334x750.png</iPhone_Launch1334>
<iPhone_Launch1792>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_1792x828.png</iPhone_Launch1792>
<iPhone_Launch2688x1242>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_2688x1242.png</iPhone_Launch2688x1242>
<iPad_AppIcon83_5>$(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_83.5x83.5.png</iPad_AppIcon83_5>
<iPad_AppIcon167>$(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_167x167.png</iPad_AppIcon167>
<iPad_Launch1668>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1668x2224.png</iPad_Launch1668>
<iPad_Launch1668x2388>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1668x2388.png</iPad_Launch1668x2388>
<iPad_Launch2048x2732>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_2048x2732.png</iPad_Launch2048x2732>
<iPad_Launch2224>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2224x1668.png</iPad_Launch2224>
<iPad_Launch2388x1668>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2388x1668.png</iPad_Launch2388x1668>
<iPad_Launch2732x2048>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2732x2048.png</iPad_Launch2732x2048>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_iOSDevice64)'!=''">
<DCC_UsePackage>DBXSqliteDriver;IndyIPCommon;bindcompdbx;DBXInterBaseDriver;IndyIPServer;IndySystem;tethering;fmxFireDAC;bindcompfmx;FMXTee;DbxCommonDriver;FmxTeeUI;fmx;xmlrtl;rtl;DbxClientDriver;CustomIPTransport;dbexpress;IndyCore;bindcomp;dsnap;IndyIPClient;dbxcds;bindengine;dsnapxml;dbrtl;IndyProtocols;fmxase;$(DCC_UsePackage)</DCC_UsePackage>
<VerInfo_Keys>CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0;CFBundleShortVersionString=1.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone &amp; iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=;NSContactsUsageDescription=The reason for accessing the contacts;NSPhotoLibraryUsageDescription=The reason for accessing the photo library;NSCameraUsageDescription=The reason for accessing the camera</VerInfo_Keys>
<VerInfo_UIDeviceFamily>iPhoneAndiPad</VerInfo_UIDeviceFamily>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<BT_BuildType>Debug</BT_BuildType>
<VerInfo_BundleId>$(MSBuildProjectName)</VerInfo_BundleId>
<iPhone_AppIcon57>$(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_57x57.png</iPhone_AppIcon57>
<iPhone_AppIcon60>$(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png</iPhone_AppIcon60>
<iPhone_AppIcon87>$(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_87x87.png</iPhone_AppIcon87>
<iPhone_AppIcon114>$(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_114x114.png</iPhone_AppIcon114>
<iPhone_AppIcon120>$(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png</iPhone_AppIcon120>
<iPhone_AppIcon180>$(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_180x180.png</iPhone_AppIcon180>
<iPhone_Launch320>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_320x480.png</iPhone_Launch320>
<iPhone_Launch640>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_640x960.png</iPhone_Launch640>
<iPhone_Launch640x1136>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_640x1136.png</iPhone_Launch640x1136>
<iPhone_Launch750>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_750x1334.png</iPhone_Launch750>
<iPhone_Launch1242>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_1242x2208.png</iPhone_Launch1242>
<iPhone_Launch2208>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_2208x1242.png</iPhone_Launch2208>
<iPhone_Launch1125>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_1125x2436.png</iPhone_Launch1125>
<iPhone_Launch2436>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_2436x1125.png</iPhone_Launch2436>
<iPhone_Spotlight29>$(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_29x29.png</iPhone_Spotlight29>
<iPhone_Spotlight40>$(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png</iPhone_Spotlight40>
<iPhone_Spotlight58>$(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_58x58.png</iPhone_Spotlight58>
<iPhone_Spotlight80>$(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png</iPhone_Spotlight80>
<iPad_AppIcon72>$(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_72x72.png</iPad_AppIcon72>
<iPad_AppIcon76>$(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png</iPad_AppIcon76>
<iPad_AppIcon144>$(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_144x144.png</iPad_AppIcon144>
<iPad_AppIcon152>$(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png</iPad_AppIcon152>
<iPad_Launch768>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1004.png</iPad_Launch768>
<iPad_Launch768x1024>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png</iPad_Launch768x1024>
<iPad_Launch1024>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x748.png</iPad_Launch1024>
<iPad_Launch1024x768>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png</iPad_Launch1024x768>
<iPad_Launch1536>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2008.png</iPad_Launch1536>
<iPad_Launch1536x2048>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png</iPad_Launch1536x2048>
<iPad_Launch2048>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1496.png</iPad_Launch2048>
<iPad_Launch2048x1536>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png</iPad_Launch2048x1536>
<iPad_SpotLight40>$(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png</iPad_SpotLight40>
<iPad_SpotLight50>$(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_50x50.png</iPad_SpotLight50>
<iPad_SpotLight80>$(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png</iPad_SpotLight80>
<iPad_SpotLight100>$(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_100x100.png</iPad_SpotLight100>
<iPad_Setting29>$(BDS)\bin\Artwork\iOS\iPad\FM_SettingIcon_29x29.png</iPad_Setting29>
<iPad_Setting58>$(BDS)\bin\Artwork\iOS\iPad\FM_SettingIcon_58x58.png</iPad_Setting58>
<iPhone_Spotlight120>$(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_120x120.png</iPhone_Spotlight120>
<iPhone_Launch828>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_828x1792.png</iPhone_Launch828>
<iPhone_Launch1136x640>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_1136x640.png</iPhone_Launch1136x640>
<iPhone_Launch1242x2688>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_1242x2688.png</iPhone_Launch1242x2688>
<iPhone_Launch1334>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_1334x750.png</iPhone_Launch1334>
<iPhone_Launch1792>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_1792x828.png</iPhone_Launch1792>
<iPhone_Launch2688x1242>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_2688x1242.png</iPhone_Launch2688x1242>
<iPad_AppIcon83_5>$(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_83.5x83.5.png</iPad_AppIcon83_5>
<iPad_AppIcon167>$(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_167x167.png</iPad_AppIcon167>
<iPad_Launch1668>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1668x2224.png</iPad_Launch1668>
<iPad_Launch1668x2388>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1668x2388.png</iPad_Launch1668x2388>
<iPad_Launch2048x2732>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_2048x2732.png</iPad_Launch2048x2732>
<iPad_Launch2224>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2224x1668.png</iPad_Launch2224>
<iPad_Launch2388x1668>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2388x1668.png</iPad_Launch2388x1668>
<iPad_Launch2732x2048>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2732x2048.png</iPad_Launch2732x2048>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_iOSSimulator)'!=''">
<DCC_UsePackage>DBXSqliteDriver;IndyIPCommon;bindcompdbx;DBXInterBaseDriver;IndyIPServer;IndySystem;tethering;fmxFireDAC;bindcompfmx;FMXTee;DbxCommonDriver;FmxTeeUI;fmx;xmlrtl;rtl;DbxClientDriver;CustomIPTransport;dbexpress;IndyCore;bindcomp;dsnap;IndyIPClient;dbxcds;bindengine;dsnapxml;dbrtl;IndyProtocols;fmxase;$(DCC_UsePackage)</DCC_UsePackage>
<VerInfo_Keys>CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0;CFBundleShortVersionString=1.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone &amp; iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=;NSContactsUsageDescription=The reason for accessing the contacts;NSPhotoLibraryUsageDescription=The reason for accessing the photo library;NSCameraUsageDescription=The reason for accessing the camera</VerInfo_Keys>
<VerInfo_UIDeviceFamily>iPhoneAndiPad</VerInfo_UIDeviceFamily>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<iPhone_AppIcon57>$(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_57x57.png</iPhone_AppIcon57>
<iPhone_AppIcon60>$(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png</iPhone_AppIcon60>
<iPhone_AppIcon87>$(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_87x87.png</iPhone_AppIcon87>
<iPhone_AppIcon114>$(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_114x114.png</iPhone_AppIcon114>
<iPhone_AppIcon120>$(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png</iPhone_AppIcon120>
<iPhone_AppIcon180>$(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_180x180.png</iPhone_AppIcon180>
<iPhone_Launch320>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_320x480.png</iPhone_Launch320>
<iPhone_Launch640>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_640x960.png</iPhone_Launch640>
<iPhone_Launch640x1136>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_640x1136.png</iPhone_Launch640x1136>
<iPhone_Launch750>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_750x1334.png</iPhone_Launch750>
<iPhone_Launch1242>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_1242x2208.png</iPhone_Launch1242>
<iPhone_Launch2208>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_2208x1242.png</iPhone_Launch2208>
<iPhone_Launch1125>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_1125x2436.png</iPhone_Launch1125>
<iPhone_Launch2436>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_2436x1125.png</iPhone_Launch2436>
<iPhone_Spotlight29>$(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_29x29.png</iPhone_Spotlight29>
<iPhone_Spotlight40>$(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png</iPhone_Spotlight40>
<iPhone_Spotlight58>$(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_58x58.png</iPhone_Spotlight58>
<iPhone_Spotlight80>$(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png</iPhone_Spotlight80>
<iPad_AppIcon72>$(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_72x72.png</iPad_AppIcon72>
<iPad_AppIcon76>$(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png</iPad_AppIcon76>
<iPad_AppIcon144>$(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_144x144.png</iPad_AppIcon144>
<iPad_AppIcon152>$(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png</iPad_AppIcon152>
<iPad_Launch768>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1004.png</iPad_Launch768>
<iPad_Launch768x1024>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png</iPad_Launch768x1024>
<iPad_Launch1024>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x748.png</iPad_Launch1024>
<iPad_Launch1024x768>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png</iPad_Launch1024x768>
<iPad_Launch1536>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2008.png</iPad_Launch1536>
<iPad_Launch1536x2048>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png</iPad_Launch1536x2048>
<iPad_Launch2048>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1496.png</iPad_Launch2048>
<iPad_Launch2048x1536>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png</iPad_Launch2048x1536>
<iPad_SpotLight40>$(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png</iPad_SpotLight40>
<iPad_SpotLight50>$(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_50x50.png</iPad_SpotLight50>
<iPad_SpotLight80>$(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png</iPad_SpotLight80>
<iPad_SpotLight100>$(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_100x100.png</iPad_SpotLight100>
<iPad_Setting29>$(BDS)\bin\Artwork\iOS\iPad\FM_SettingIcon_29x29.png</iPad_Setting29>
<iPad_Setting58>$(BDS)\bin\Artwork\iOS\iPad\FM_SettingIcon_58x58.png</iPad_Setting58>
<iPhone_Spotlight120>$(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_120x120.png</iPhone_Spotlight120>
<iPhone_Launch828>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_828x1792.png</iPhone_Launch828>
<iPhone_Launch1136x640>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_1136x640.png</iPhone_Launch1136x640>
<iPhone_Launch1242x2688>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_1242x2688.png</iPhone_Launch1242x2688>
<iPhone_Launch1334>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_1334x750.png</iPhone_Launch1334>
<iPhone_Launch1792>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_1792x828.png</iPhone_Launch1792>
<iPhone_Launch2688x1242>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_2688x1242.png</iPhone_Launch2688x1242>
<iPad_AppIcon83_5>$(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_83.5x83.5.png</iPad_AppIcon83_5>
<iPad_AppIcon167>$(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_167x167.png</iPad_AppIcon167>
<iPad_Launch1668>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1668x2224.png</iPad_Launch1668>
<iPad_Launch1668x2388>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1668x2388.png</iPad_Launch1668x2388>
<iPad_Launch2048x2732>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_2048x2732.png</iPad_Launch2048x2732>
<iPad_Launch2224>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2224x1668.png</iPad_Launch2224>
<iPad_Launch2388x1668>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2388x1668.png</iPad_Launch2388x1668>
<iPad_Launch2732x2048>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2732x2048.png</iPad_Launch2732x2048>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_OSX32)'!=''">
<DCC_UsePackage>DBXSqliteDriver;IndyIPCommon;bindcompdbx;DBXInterBaseDriver;IndyIPServer;IndySystem;tethering;fmxFireDAC;bindcompfmx;FireDACPgDriver;inetdb;FMXTee;DbxCommonDriver;FmxTeeUI;fmx;fmxdae;xmlrtl;fmxobj;rtl;DbxClientDriver;CustomIPTransport;dbexpress;IndyCore;bindcomp;dsnap;IndyIPClient;dbxcds;bindengine;DBXMySQLDriver;dsnapxml;FireDACMySQLDriver;dbrtl;IndyProtocols;inetdbxpress;FireDACCommonODBC;fmxase;$(DCC_UsePackage)</DCC_UsePackage>
<VerInfo_Keys>CFBundleName=$(MSBuildProjectName);CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleVersion=1.0.0;CFBundleShortVersionString=1.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);NSHighResolutionCapable=true;LSApplicationCategoryType=public.app-category.utilities;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;NSContactsUsageDescription=The reason for accessing the contacts</VerInfo_Keys>
<BT_BuildType>Debug</BT_BuildType>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win32)'!=''">
<DCC_UsePackage>DBXSqliteDriver;IndyIPCommon;bindcompdbx;DBXInterBaseDriver;vcl;IndyIPServer;vclactnband;vclFireDAC;IndySystem;tethering;svnui;dsnapcon;FireDACADSDriver;FireDACMSAccDriver;fmxFireDAC;vclimg;TeeDB;vcltouch;vcldb;bindcompfmx;svn;FireDACPgDriver;inetdb;FMXTee;DbxCommonDriver;FmxTeeUI;fmx;fmxdae;xmlrtl;Tee;fmxobj;vclwinx;rtl;DbxClientDriver;CustomIPTransport;vcldsnap;dbexpress;IndyCore;vclx;bindcomp;appanalytics;dsnap;IndyIPClient;bindcompvcl;TeeUI;VCLRESTComponents;dbxcds;VclSmp;adortl;vclie;bindengine;DBXMySQLDriver;dsnapxml;FireDACMySQLDriver;dbrtl;IndyProtocols;inetdbxpress;FireDACCommonODBC;fmxase;$(DCC_UsePackage)</DCC_UsePackage>
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
<BT_BuildType>Debug</BT_BuildType>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
<VerInfo_Locale>1033</VerInfo_Locale>
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
<UWP_DelphiLogo44>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png</UWP_DelphiLogo44>
<UWP_DelphiLogo150>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png</UWP_DelphiLogo150>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win64)'!=''">
<DCC_UsePackage>DBXSqliteDriver;IndyIPCommon;bindcompdbx;DBXInterBaseDriver;vcl;IndyIPServer;vclactnband;vclFireDAC;IndySystem;tethering;dsnapcon;FireDACADSDriver;FireDACMSAccDriver;fmxFireDAC;vclimg;TeeDB;vcltouch;vcldb;bindcompfmx;FireDACPgDriver;inetdb;FMXTee;DbxCommonDriver;FmxTeeUI;fmx;fmxdae;xmlrtl;Tee;fmxobj;vclwinx;rtl;DbxClientDriver;CustomIPTransport;vcldsnap;dbexpress;IndyCore;vclx;bindcomp;appanalytics;dsnap;IndyIPClient;bindcompvcl;TeeUI;VCLRESTComponents;dbxcds;VclSmp;adortl;vclie;bindengine;DBXMySQLDriver;dsnapxml;FireDACMySQLDriver;dbrtl;IndyProtocols;inetdbxpress;FireDACCommonODBC;fmxase;$(DCC_UsePackage)</DCC_UsePackage>
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace)</DCC_Namespace>
<BT_BuildType>Debug</BT_BuildType>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
<VerInfo_Locale>1033</VerInfo_Locale>
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
<UWP_DelphiLogo44>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png</UWP_DelphiLogo44>
<UWP_DelphiLogo150>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png</UWP_DelphiLogo150>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1)'!=''">
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
<DCC_DebugDCUs>true</DCC_DebugDCUs>
<DCC_Optimize>false</DCC_Optimize>
<DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
<DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
<DCC_RemoteDebug>true</DCC_RemoteDebug>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
<DCC_RemoteDebug>false</DCC_RemoteDebug>
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_Locale>1033</VerInfo_Locale>
<DCC_ExeOutput>..\..\Deploy</DCC_ExeOutput>
<DCC_DcuOutput>..\..\Lib</DCC_DcuOutput>
<AppDPIAwarenessMode>PerMonitor</AppDPIAwarenessMode>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1_Win64)'!=''">
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
<AppDPIAwarenessMode>PerMonitor</AppDPIAwarenessMode>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''">
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
<DCC_DebugInformation>0</DCC_DebugInformation>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
<AppDPIAwarenessMode>PerMonitor</AppDPIAwarenessMode>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_Win64)'!=''">
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
<AppDPIAwarenessMode>PerMonitor</AppDPIAwarenessMode>
</PropertyGroup>
<ItemGroup>
<DelphiCompile Include="$(MainSource)">
<MainSource>MainSource</MainSource>
</DelphiCompile>
<DCCReference Include="Sample.Main.pas">
<Form>Form1</Form>
<FormType>fmx</FormType>
</DCCReference>
<DCCReference Include="Sample.Data.Employee.pas"/>
<DCCReference Include="Sample.SwagDoc.pas"/>
<DCCReference Include="Sample.Api.Employee.pas"/>
<DCCReference Include="Sample.Data.Address.pas"/>
<BuildConfiguration Include="Release">
<Key>Cfg_2</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
<BuildConfiguration Include="Base">
<Key>Base</Key>
</BuildConfiguration>
<BuildConfiguration Include="Debug">
<Key>Cfg_1</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
</ItemGroup>
<ProjectExtensions>
<Borland.Personality>Delphi.Personality.12</Borland.Personality>
<Borland.ProjectType>Application</Borland.ProjectType>
<BorlandProject>
<Delphi.Personality>
<Source>
<Source Name="MainSource">SampleApi.dpr</Source>
</Source>
<Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k250.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dclofficexp250.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
</Excluded_Packages>
</Delphi.Personality>
<Deployment Version="3">
<DeployFile LocalName="$(BDS)\Redist\osx32\libcgunwind.1.0.dylib" Class="DependencyModule">
<Platform Name="OSX32">
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="$(BDS)\Redist\osx64\libcgsqlite3.dylib" Class="DependencyModule">
<Platform Name="OSX64">
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="$(BDS)\Redist\iossimulator\libPCRE.dylib" Class="DependencyModule">
<Platform Name="iOSSimulator">
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="$(BDS)\Redist\iossimulator\libcgunwind.1.0.dylib" Class="DependencyModule">
<Platform Name="iOSSimulator">
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="$(BDS)\Redist\iossimulator\libpcre.dylib" Class="DependencyModule">
<Platform Name="iOSSimulator">
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="$(BDS)\Redist\osx32\libcgsqlite3.dylib" Class="DependencyModule">
<Platform Name="OSX32">
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="Win32\Debug\SampleApi.exe" Configuration="Debug" Class="ProjectOutput">
<Platform Name="Win32">
<RemoteName>SampleApi.exe</RemoteName>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployClass Name="AdditionalDebugSymbols">
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidClassesDexFile">
<Platform Name="Android">
<RemoteDir>classes</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidFileProvider">
<Platform Name="Android">
<RemoteDir>res\xml</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidGDBServer">
<Platform Name="Android">
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidLibnativeArmeabiFile">
<Platform Name="Android">
<RemoteDir>library\lib\armeabi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidLibnativeMipsFile">
<Platform Name="Android">
<RemoteDir>library\lib\mips</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidServiceOutput">
<Platform Name="Android">
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidSplashImageDef">
<Platform Name="Android">
<RemoteDir>res\drawable</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidSplashStyles">
<Platform Name="Android">
<RemoteDir>res\values</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidSplashStylesV21">
<Platform Name="Android">
<RemoteDir>res\values-v21</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_DefaultAppIcon">
<Platform Name="Android">
<RemoteDir>res\drawable</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon144">
<Platform Name="Android">
<RemoteDir>res\drawable-xxhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon36">
<Platform Name="Android">
<RemoteDir>res\drawable-ldpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon48">
<Platform Name="Android">
<RemoteDir>res\drawable-mdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon72">
<Platform Name="Android">
<RemoteDir>res\drawable-hdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon96">
<Platform Name="Android">
<RemoteDir>res\drawable-xhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_SplashImage426">
<Platform Name="Android">
<RemoteDir>res\drawable-small</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_SplashImage470">
<Platform Name="Android">
<RemoteDir>res\drawable-normal</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_SplashImage640">
<Platform Name="Android">
<RemoteDir>res\drawable-large</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_SplashImage960">
<Platform Name="Android">
<RemoteDir>res\drawable-xlarge</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="DebugSymbols">
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
</DeployClass>
<DeployClass Name="DependencyFramework">
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.framework</Extensions>
</Platform>
<Platform Name="OSX64">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.framework</Extensions>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
</DeployClass>
<DeployClass Name="DependencyModule">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="OSX64">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
<Extensions>.dll;.bpl</Extensions>
</Platform>
</DeployClass>
<DeployClass Required="true" Name="DependencyPackage">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="OSX64">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
<Extensions>.bpl</Extensions>
</Platform>
</DeployClass>
<DeployClass Name="File">
<Platform Name="Android">
<Operation>0</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>0</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>0</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>0</Operation>
</Platform>
<Platform Name="OSX32">
<RemoteDir>Contents\Resources\StartUp\</RemoteDir>
<Operation>0</Operation>
</Platform>
<Platform Name="OSX64">
<RemoteDir>Contents\Resources\StartUp\</RemoteDir>
<Operation>0</Operation>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_Launch1024">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_Launch1536">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_Launch2048">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_Launch768">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Launch320">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Launch640">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Launch640x1136">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectAndroidManifest">
<Platform Name="Android">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSDeviceDebug">
<Platform Name="iOSDevice32">
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSDeviceResourceRules">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSEntitlements">
<Platform Name="iOSDevice32">
<RemoteDir>..\</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<RemoteDir>..\</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSInfoPList">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSResource">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectOSXDebug">
<Platform Name="OSX64">
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectOSXEntitlements">
<Platform Name="OSX32">
<RemoteDir>..\</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="OSX64">
<RemoteDir>..\</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectOSXInfoPList">
<Platform Name="OSX32">
<RemoteDir>Contents</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="OSX64">
<RemoteDir>Contents</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectOSXResource">
<Platform Name="OSX32">
<RemoteDir>Contents\Resources</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="OSX64">
<RemoteDir>Contents\Resources</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Required="true" Name="ProjectOutput">
<Platform Name="Android">
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="Linux64">
<Operation>1</Operation>
</Platform>
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="OSX64">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectUWPManifest">
<Platform Name="Win32">
<Operation>1</Operation>
</Platform>
<Platform Name="Win64">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="UWP_DelphiLogo150">
<Platform Name="Win32">
<RemoteDir>Assets</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Win64">
<RemoteDir>Assets</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="UWP_DelphiLogo44">
<Platform Name="Win32">
<RemoteDir>Assets</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Win64">
<RemoteDir>Assets</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="Linux64" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="OSX32" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="Android" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="OSX64" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>
</Deployment>
<Platforms>
<Platform value="Android">False</Platform>
<Platform value="iOSDevice32">False</Platform>
<Platform value="iOSDevice64">False</Platform>
<Platform value="iOSSimulator">False</Platform>
<Platform value="OSX32">False</Platform>
<Platform value="Win32">True</Platform>
<Platform value="Win64">False</Platform>
</Platforms>
</BorlandProject>
<ProjectFileVersion>12</ProjectFileVersion>
</ProjectExtensions>
<Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
<Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
<Import Project="$(MSBuildProjectName).deployproj" Condition="Exists('$(MSBuildProjectName).deployproj')"/>
</Project>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 445 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -1,98 +0,0 @@
<!-- HTML for static distribution bundle build -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Swagger UI</title>
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,700|Source+Code+Pro:300,600|Titillium+Web:400,600,700" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" >
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
<style>
html
{
box-sizing: border-box;
overflow: -moz-scrollbars-vertical;
overflow-y: scroll;
}
*,
*:before,
*:after
{
box-sizing: inherit;
}
body {
margin:0;
background: #fafafa;
}
</style>
</head>
<body>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="position:absolute;width:0;height:0">
<defs>
<symbol viewBox="0 0 20 20" id="unlocked">
<path d="M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V6h2v-.801C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8z"></path>
</symbol>
<symbol viewBox="0 0 20 20" id="locked">
<path d="M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8zM12 8H8V5.199C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8z"/>
</symbol>
<symbol viewBox="0 0 20 20" id="close">
<path d="M14.348 14.849c-.469.469-1.229.469-1.697 0L10 11.819l-2.651 3.029c-.469.469-1.229.469-1.697 0-.469-.469-.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-.469-.469-.469-1.228 0-1.697.469-.469 1.228-.469 1.697 0L10 8.183l2.651-3.031c.469-.469 1.228-.469 1.697 0 .469.469.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c.469.469.469 1.229 0 1.698z"/>
</symbol>
<symbol viewBox="0 0 20 20" id="large-arrow">
<path d="M13.25 10L6.109 2.58c-.268-.27-.268-.707 0-.979.268-.27.701-.27.969 0l7.83 7.908c.268.271.268.709 0 .979l-7.83 7.908c-.268.271-.701.27-.969 0-.268-.269-.268-.707 0-.979L13.25 10z"/>
</symbol>
<symbol viewBox="0 0 20 20" id="large-arrow-down">
<path d="M17.418 6.109c.272-.268.709-.268.979 0s.271.701 0 .969l-7.908 7.83c-.27.268-.707.268-.979 0l-7.908-7.83c-.27-.268-.27-.701 0-.969.271-.268.709-.268.979 0L10 13.25l7.418-7.141z"/>
</symbol>
<symbol viewBox="0 0 24 24" id="jump-to">
<path d="M19 7v4H5.83l3.58-3.59L8 6l-6 6 6 6 1.41-1.41L5.83 13H21V7z"/>
</symbol>
<symbol viewBox="0 0 24 24" id="expand">
<path d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"/>
</symbol>
</defs>
</svg>
<div id="swagger-ui"></div>
<script src="./swagger-ui-bundle.js"> </script>
<script src="./swagger-ui-standalone-preset.js"> </script>
<script>
window.onload = function() {
// Build a system
const ui = SwaggerUIBundle({
url: "/api/help/swagger.json",
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset.slice(1) // No Topbar
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout",
validatorUrl: null,
//docExpansion: "none",
filter: true
})
window.ui = ui
}
</script>
</body>
</html>

View File

@ -1,57 +0,0 @@
<!doctype html>
<html lang="en-US">
<body onload="run()">
</body>
</html>
<script>
'use strict';
function run () {
var oauth2 = window.opener.swaggerUIRedirectOauth2;
var sentState = oauth2.state;
var redirectUrl = oauth2.redirectUrl;
var isValid, qp, arr;
if (/code|token|error/.test(window.location.hash)) {
qp = window.location.hash.substring(1);
} else {
qp = location.search.substring(1);
}
arr = qp.split("&")
arr.forEach(function (v,i,_arr) { _arr[i] = '"' + v.replace('=', '":"') + '"';})
qp = qp ? JSON.parse('{' + arr.join() + '}',
function (key, value) {
return key === "" ? value : decodeURIComponent(value)
}
) : {}
isValid = qp.state === sentState
if (oauth2.auth.schema.get("flow") === "accessCode" && !oauth2.auth.code) {
if (!isValid) {
oauth2.errCb({
authId: oauth2.auth.name,
source: "auth",
level: "warning",
message: "Authorization may be unsafe, passed state was changed in server Passed state wasn't returned from auth server"
});
}
if (qp.code) {
delete oauth2.state;
oauth2.auth.code = qp.code;
oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl});
} else {
oauth2.errCb({
authId: oauth2.auth.name,
source: "auth",
level: "error",
message: "Authorization failed: no accessCode received from the server"
});
}
} else {
oauth2.callback({auth: oauth2.auth, token: qp, isValid: isValid, redirectUrl: redirectUrl});
}
window.close();
}
</script>

View File

@ -1,20 +0,0 @@
When creating a Swagger documentation for your REST API you can produce a page like the following example.
![image](https://user-images.githubusercontent.com/20048296/39936694-a4d9ac9a-5523-11e8-8161-98d0e396eb6f.png)
http://petstore.swagger.io
For you to produce a page containing a Swagger documentation you need the Swagger UI distribution files.
These files you can find in the github swagger-api / swagger-ui repository.
https://github.com/swagger-api/swagger-ui/tree/master/dist
![image](https://user-images.githubusercontent.com/20048296/39937130-2925f868-5525-11e8-921d-c9ff0f59fefd.png)
First you need to download the swagger user interface files and generate the swagger.json file. You then need to change the index.html file to indicate the relative path of the location where the swagger.json file is located on your web server that is hosting the swagger user interface files.
See an example below.
![image](https://user-images.githubusercontent.com/20048296/39946376-49ad0df0-5544-11e8-8a5c-0980f5e6c257.png)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,704 +0,0 @@
{
"swagger":"2.0",
"info":
{
"version":"v1",
"title":"Sample API",
"description":"Sample API Description",
"termsOfService":"http:\/\/www.apache.org\/licenses\/LICENSE-2.0.txt",
"contact":
{
"name":"Marcelo Jaloto",
"email":"marcelojaloto@gmail.com",
"url":"https:\/\/github.com\/marcelojaloto\/SwagDoc"
}
,
"license":
{
"name":"Apache License - Version 2.0, January 2004",
"url":"http:\/\/www.apache.org\/licenses\/LICENSE-2.0"
}
}
,
"host":"localhost",
"basePath":"\/api",
"schemes":
[
"http"
]
,
"consumes":
[
"application\/json"
]
,
"produces":
[
"application\/json"
]
,
"paths":
{
"\/employees":
{
"get":
{
"tags":
[
"API Employee"
]
,
"description":"Returns a employee list.",
"operationId":"{A9A8D343-00EB-402A-8248-94BDA7B6ECD4}",
"responses":
{
"200":
{
"description":"Successfully returns data",
"schema":
{
"type":"object",
"properties":
{
"employees":
{
"type":"array",
"description":"The employee datas.",
"items":
{
"type":"object",
"properties":
{
"employee":
{
"type":"object",
"description":"Employee request data",
"required":
[
"name",
"gender"
]
,
"properties":
{
"id":
{
"type":"integer",
"description":"The employee identification code.",
"format":"int64"
}
,
"name":
{
"type":"string",
"description":"The employee full name.",
"maxLength":80
}
,
"phone":
{
"type":"string",
"description":"The employee phone number."
}
,
"hireDate":
{
"type":"string",
"description":"The employee hire date.",
"format":"yyyy-MM-dd"
}
,
"salary":
{
"type":"number",
"description":"The employee gross salary."
}
,
"gender":
{
"type":"string",
"description":"The employee gender.",
"enum":
[
"male",
"female"
]
}
,
"address":
{
"type":"object",
"description":"The employee full address.",
"properties":
{
"description":
{
"type":"string",
"description":"The employee address description."
}
,
"city":
{
"type":"string",
"description":"The employee address city."
}
,
"region":
{
"type":"string",
"description":"The employee address region."
}
,
"country":
{
"type":"string",
"description":"The employee address country."
}
,
"postalCode":
{
"type":"string",
"description":"The employee address postal code."
}
}
}
}
}
}
}
}
}
}
}
}
}
,
"post":
{
"tags":
[
"API Employee"
]
,
"description":"Creates a employee.",
"operationId":"{C450E1E0-341D-4947-A156-9C167BE021D5}",
"parameters":
[
{
"in":"body",
"name":"employee",
"required":true,
"schema":
{
"$ref":"#\/definitions\/employee"
}
}
]
,
"responses":
{
"201":
{
"description":"Successfully creates data",
"schema":
{
"type":"object",
"properties":
{
"employee":
{
"type":"object",
"description":"Employee request data",
"required":
[
"name",
"gender"
]
,
"properties":
{
"id":
{
"type":"integer",
"description":"The employee identification code.",
"format":"int64"
}
,
"name":
{
"type":"string",
"description":"The employee full name.",
"maxLength":80
}
,
"phone":
{
"type":"string",
"description":"The employee phone number."
}
,
"hireDate":
{
"type":"string",
"description":"The employee hire date.",
"format":"yyyy-MM-dd"
}
,
"salary":
{
"type":"number",
"description":"The employee gross salary."
}
,
"gender":
{
"type":"string",
"description":"The employee gender.",
"enum":
[
"male",
"female"
]
}
,
"address":
{
"type":"object",
"description":"The employee full address.",
"properties":
{
"description":
{
"type":"string",
"description":"The employee address description."
}
,
"city":
{
"type":"string",
"description":"The employee address city."
}
,
"region":
{
"type":"string",
"description":"The employee address region."
}
,
"country":
{
"type":"string",
"description":"The employee address country."
}
,
"postalCode":
{
"type":"string",
"description":"The employee address postal code."
}
}
}
}
}
}
}
}
}
}
}
,
"\/employees\/{id}":
{
"get":
{
"tags":
[
"API Employee"
]
,
"description":"Returns a employee.",
"operationId":"{2DDE05B6-C01A-4EB8-B7CD-2041C51C97C7}",
"parameters":
[
{
"in":"path",
"name":"id",
"required":true,
"type":"integer"
}
]
,
"responses":
{
"200":
{
"description":"Successfully returns data",
"schema":
{
"type":"object",
"properties":
{
"employee":
{
"type":"object",
"description":"Employee request data",
"required":
[
"name",
"gender"
]
,
"properties":
{
"id":
{
"type":"integer",
"description":"The employee identification code.",
"format":"int64"
}
,
"name":
{
"type":"string",
"description":"The employee full name.",
"maxLength":80
}
,
"phone":
{
"type":"string",
"description":"The employee phone number."
}
,
"hireDate":
{
"type":"string",
"description":"The employee hire date.",
"format":"yyyy-MM-dd"
}
,
"salary":
{
"type":"number",
"description":"The employee gross salary."
}
,
"gender":
{
"type":"string",
"description":"The employee gender.",
"enum":
[
"male",
"female"
]
}
,
"address":
{
"type":"object",
"description":"The employee full address.",
"properties":
{
"description":
{
"type":"string",
"description":"The employee address description."
}
,
"city":
{
"type":"string",
"description":"The employee address city."
}
,
"region":
{
"type":"string",
"description":"The employee address region."
}
,
"country":
{
"type":"string",
"description":"The employee address country."
}
,
"postalCode":
{
"type":"string",
"description":"The employee address postal code."
}
}
}
}
}
}
}
}
}
}
,
"put":
{
"tags":
[
"API Employee"
]
,
"description":"Updates a employee.",
"operationId":"{28E989FB-0225-40BD-A97E-8D1EA80D09AF}",
"parameters":
[
{
"in":"path",
"name":"id",
"required":true,
"type":"integer"
}
,
{
"in":"body",
"name":"employee",
"required":true,
"schema":
{
"$ref":"#\/definitions\/employee"
}
}
]
,
"responses":
{
"200":
{
"description":"Successfully updates data",
"schema":
{
"type":"object",
"properties":
{
"employee":
{
"type":"object",
"description":"Employee request data",
"required":
[
"name",
"gender"
]
,
"properties":
{
"id":
{
"type":"integer",
"description":"The employee identification code.",
"format":"int64"
}
,
"name":
{
"type":"string",
"description":"The employee full name.",
"maxLength":80
}
,
"phone":
{
"type":"string",
"description":"The employee phone number."
}
,
"hireDate":
{
"type":"string",
"description":"The employee hire date.",
"format":"yyyy-MM-dd"
}
,
"salary":
{
"type":"number",
"description":"The employee gross salary."
}
,
"gender":
{
"type":"string",
"description":"The employee gender.",
"enum":
[
"male",
"female"
]
}
,
"address":
{
"type":"object",
"description":"The employee full address.",
"properties":
{
"description":
{
"type":"string",
"description":"The employee address description."
}
,
"city":
{
"type":"string",
"description":"The employee address city."
}
,
"region":
{
"type":"string",
"description":"The employee address region."
}
,
"country":
{
"type":"string",
"description":"The employee address country."
}
,
"postalCode":
{
"type":"string",
"description":"The employee address postal code."
}
}
}
}
}
}
}
}
}
}
,
"delete":
{
"tags":
[
"API Employee"
]
,
"description":"Deletes a employee.",
"operationId":"{F47F38F3-2B99-4481-AFDD-ECD89893FEA0}",
"parameters":
[
{
"in":"path",
"name":"id",
"required":true,
"type":"integer"
}
]
,
"responses":
{
"204":
{
"description":"Successfully deletes data"
}
}
}
}
}
,
"definitions":
{
"employee":
{
"type":"object",
"description":"Employee response data",
"required":
[
"name",
"gender"
]
,
"properties":
{
"name":
{
"type":"string",
"description":"The employee full name.",
"maxLength":80
}
,
"phone":
{
"type":"string",
"description":"The employee phone number."
}
,
"hireDate":
{
"type":"string",
"description":"The employee hire date.",
"format":"yyyy-MM-dd"
}
,
"salary":
{
"type":"number",
"description":"The employee gross salary."
}
,
"gender":
{
"type":"string",
"description":"The employee gender.",
"enum":
[
"male",
"female"
]
}
,
"address":
{
"type":"object",
"description":"The employee full address.",
"properties":
{
"description":
{
"type":"string",
"description":"The employee address description."
}
,
"city":
{
"type":"string",
"description":"The employee address city."
}
,
"region":
{
"type":"string",
"description":"The employee address region."
}
,
"country":
{
"type":"string",
"description":"The employee address country."
}
,
"postalCode":
{
"type":"string",
"description":"The employee address postal code."
}
}
}
}
}
}
}

View File

@ -1,201 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -1,78 +0,0 @@
# SwagDoc
SwagDoc is a Delphi library to generate swagger.json file for Swagger Spec version 2.0. Create a public documentation REST API using Swagger 2.0 for Delphi Language. SwagDoc's only responsibility is to generate the swagger.json file. The swagger.json file is responsible for containing all the documentation for your REST API. This file must be attached to the Swagger UI (User Interface) files.
[![PayPal donate button](https://user-images.githubusercontent.com/26885358/62580349-60bd8780-b87c-11e9-901e-425cf2a83671.png)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=AW8TZ2QTDA7K8)
## Swagger (Open API) - version 2.0
SwagDoc follows the specification 2.0 because it is more popular in the market and also because it is considered a more stable version to exist the longest. SwagDoc does not yet support the Swagger 3.0 version, but depending on the demand and contributions to the project it may evolve to support spec 3.0.
The main prerequisite for working with SwagDoc is to know the Swagger 2.0 specification that can be viewed in the link below.
https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md
https://swagger.io/docs/specification/2-0/basic-structure/
When creating a Swagger documentation for your REST API you can produce a page like the following example.
https://app.swaggerhub.com/apis-docs/swagdoc/sample-api/v1
![image](https://user-images.githubusercontent.com/20048296/46588904-c6cd5880-ca79-11e8-8a8a-ec38ba7ff95a.png)
## Json Schema
https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#schemaObject
http://json-schema.org
## SwagDoc Speeches
https://www.youtube.com/watch?v=9U3HP3B5UT0 (Pt-Br)
https://www.youtube.com/watch?v=PhgMQAd8O6c (Pt-Br)
## Swagger References and Tutorials
https://swagger.io/swagger/media/blog/wp-content/uploads/2017/02/Documenting-An-Existing-API-with-Swagger-2.pdf
https://idratherbewriting.com/learnapidoc/pubapis_swagger_intro.html
## Swagger Tools
- Swagger:
https://swagger.io
- Swagger Editor:
https://editor.swagger.io
- Swagger Hub:
https://swagger.io/tools/swaggerhub
- The classic swagger sample:
http://petstore.swagger.io
- Tools and Integrations:
https://swagger.io/tools/open-source/open-source-integrations
## Swagger UI distribution files
For you to produce a page containing a Swagger documentation you need the Swagger UI distribution files.
These files you can find in the github swagger-api / swagger-ui repository.
https://github.com/swagger-api/swagger-ui/tree/master/dist
![image](https://user-images.githubusercontent.com/20048296/39937130-2925f868-5525-11e8-921d-c9ff0f59fefd.png)
First you need to download the swagger user interface files and generate the swagger.json file. You then need to change the index.html file to indicate the relative path of the location where the swagger.json file is located on your web server that is hosting the swagger user interface files.
See an example below.
![image](https://user-images.githubusercontent.com/20048296/39946376-49ad0df0-5544-11e8-8a5c-0980f5e6c257.png)

View File

@ -1,104 +0,0 @@
{******************************************************************************}
{ }
{ Delphi SwagDoc Library }
{ Copyright (c) 2018 Marcelo Jaloto }
{ https://github.com/marcelojaloto/SwagDoc }
{ }
{******************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{******************************************************************************}
unit Json.Common.Helpers;
interface
uses
System.JSON;
type
TJSONAncestorHelper = class helper for TJSONAncestor
public
function Format: string;
end;
TJsonObjectHelper = class helper for TJsonObject
public
procedure AddPair(const pName: string; const pValue: Extended); overload;
end;
implementation
{ TJSONAncestorHelper }
function TJSONAncestorHelper.Format: string;
var
vJsonString: string;
vChar: Char;
vEOL: string;
vIndent: string;
vLeftIndent: string;
vIsEOL: Boolean;
vIsInString: Boolean;
vIsEscape: Boolean;
begin
vEOL := #13#10;
vIndent := ' ';
vIsEOL := true;
vIsInString := false;
vIsEscape := false;
vJsonString := Self.ToString;
for vChar in vJsonString do
begin
if not vIsInString and ((vChar = '{') or (vChar = '[')) then
begin
if not vIsEOL then
Result := Result + vEOL;
Result := Result + vLeftIndent + vChar + vEOL;
vLeftIndent := vLeftIndent + vIndent;
Result := Result + vLeftIndent;
vIsEOL := true;
end
else if not vIsInString and (vChar = ',') then
begin
vIsEOL := false;
Result := Result + vChar + vEOL + vLeftIndent;
end
else if not vIsInString and ((vChar = '}') or (vChar = ']')) then
begin
Delete(vLeftIndent, 1, Length(vIndent));
if not vIsEOL then
Result := Result + vEOL;
Result := Result + vLeftIndent + vChar + vEOL;
vIsEOL := true;
end
else
begin
vIsEOL := false;
Result := Result + vChar;
end;
vIsEscape := (vChar = '\') and not vIsEscape;
if not vIsEscape and (vChar = '"') then
vIsInString := not vIsInString;
end;
end;
{ TJsonObjectHelper }
procedure TJsonObjectHelper.AddPair(const pName: string; const pValue: Extended);
begin
Self.AddPair(pName, TJsonNumber.Create(pValue));
end;
end.

View File

@ -1,75 +0,0 @@
{******************************************************************************}
{ }
{ Delphi SwagDoc Library }
{ Copyright (c) 2018 Marcelo Jaloto }
{ https://github.com/marcelojaloto/SwagDoc }
{ }
{******************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{******************************************************************************}
unit Json.Schema.Common.Types;
interface
type
TSchemaKind = (skUnknown, skInteger, skInt64, skNumber, skDateTime, skDate, skTime, skEnumeration, skBoolean,
skObject, skArray, skString, skChar, skGuid);
ASchemaType = class(TCustomAttribute)
strict private
fKind: TSchemaKind;
const c_SchemaTypeBoolean = 'boolean';
const c_SchemaTypeInteger = 'integer';
const c_SchemaTypeNumber = 'number';
const c_SchemaTypeString = 'string';
const c_SchemaTypeArray = 'array';
const c_SchemaTypeObject = 'object';
function GetName: string;
public
constructor Create(const pKind: TSchemaKind);
property Name: string read GetName;
property Kind: TSchemaKind read fKind;
end;
implementation
uses
System.SysUtils;
{ ASchemaType }
constructor ASchemaType.Create(const pKind: TSchemaKind);
begin
inherited Create;
fKind := pKind;
end;
function ASchemaType.GetName: string;
begin
Result := EmptyStr;
case fKind of
skInteger, skInt64, skEnumeration: Result := c_SchemaTypeInteger;
skNumber: Result := c_SchemaTypeNumber;
skString, skChar, skGuid, skDateTime, skDate, skTime: Result := c_SchemaTypeString;
skBoolean: Result := c_SchemaTypeBoolean;
skObject: Result := c_SchemaTypeObject;
skArray: Result := c_SchemaTypeArray;
end;
end;
end.

View File

@ -1,96 +0,0 @@
{******************************************************************************}
{ }
{ Delphi SwagDoc Library }
{ Copyright (c) 2018 Marcelo Jaloto }
{ https://github.com/marcelojaloto/SwagDoc }
{ }
{******************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{******************************************************************************}
unit Json.Schema.Field.Arrays;
interface
uses
System.Json,
Json.Schema.Field,
Json.Schema.Common.Types;
type
[ASchemaType(skArray)]
TJsonFieldArray = class(TJsonField)
strict private
fItemFieldType: TJsonField;
fMinLength: Integer;
fMaxLength: Integer;
public
constructor Create; override;
destructor Destroy; override;
function Clone: TJsonField; override;
function ToJsonSchema: TJsonObject; override;
property ItemFieldType: TJsonField read fItemFieldType write fItemFieldType;
property MinLength: Integer read fMinLength write fMinLength;
property MaxLength: Integer read fMaxLength write fMaxLength;
end;
implementation
uses
System.Classes,
Json.Common.Helpers;
{ TJsonFieldArray }
function TJsonFieldArray.Clone: TJsonField;
begin
Result := inherited Clone;
TJsonFieldArray(Result).MinLength := Self.MinLength;
TJsonFieldArray(Result).MaxLength := Self.MaxLength;
TJsonFieldArray(Result).ItemFieldType := Self.ItemFieldType.Clone;
end;
constructor TJsonFieldArray.Create;
begin
inherited Create;
fItemFieldType := nil;
fMinLength := 0;
fMaxLength := 0;
end;
destructor TJsonFieldArray.Destroy;
begin
if Assigned(fItemFieldType) then
fItemFieldType.Free;
inherited Destroy;
end;
function TJsonFieldArray.ToJsonSchema: TJsonObject;
begin
Result := inherited ToJsonSchema;
if Assigned(fItemFieldType) then
Result.AddPair('items', fItemFieldType.ToJsonSchema);
if (fMinLength > 0) then
Result.AddPair('minLength', fMinLength);
if (fMaxLength > 0) then
Result.AddPair('maxLength', fMaxLength);
end;
initialization
RegisterClass(TJsonFieldArray);
end.

View File

@ -1,43 +0,0 @@
{******************************************************************************}
{ }
{ Delphi SwagDoc Library }
{ Copyright (c) 2018 Marcelo Jaloto }
{ https://github.com/marcelojaloto/SwagDoc }
{ }
{******************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{******************************************************************************}
unit Json.Schema.Field.Booleans;
interface
uses
Json.Schema.Field,
Json.Schema.Common.Types;
type
[ASchemaType(skBoolean)]
TJsonFieldBoolean = class(TJsonField);
implementation
uses
System.Classes;
initialization
RegisterClass(TJsonFieldBoolean);
end.

View File

@ -1,95 +0,0 @@
{******************************************************************************}
{ }
{ Delphi SwagDoc Library }
{ Copyright (c) 2018 Marcelo Jaloto }
{ https://github.com/marcelojaloto/SwagDoc }
{ }
{******************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{******************************************************************************}
unit Json.Schema.Field.DateTimes;
interface
uses
System.Json,
Json.Schema.Field,
Json.Schema.Common.Types;
type
[ASchemaType(skDateTime)]
TJsonFieldDateTime = class(TJsonField)
strict protected
const c_DateFormat = 'yyyy-MM-dd';
const c_TimeFormat = 'HH:mm:ss';
const c_DateTimeFormat = c_DateFormat + 'T' + c_TimeFormat;
function GetFormat: string; virtual;
public
function ToJsonSchema: TJsonObject; override;
property Format: string read GetFormat;
end;
[ASchemaType(skDate)]
TJsonFieldDate = class(TJsonFieldDateTime)
strict protected
function GetFormat: string; override;
end;
[ASchemaType(skTime)]
TJsonFieldTime = class(TJsonFieldDateTime)
strict protected
function GetFormat: string; override;
end;
implementation
uses
System.Classes;
{ TJsonFieldDateTime }
function TJsonFieldDateTime.GetFormat: string;
begin
Result := c_DateTimeFormat;
end;
function TJsonFieldDateTime.ToJsonSchema: TJsonObject;
begin
Result := inherited ToJsonSchema;
Result.AddPair('format', GetFormat);
end;
{ TJsonFieldDate }
function TJsonFieldDate.GetFormat: string;
begin
Result := c_DateFormat;
end;
{ TJsonFieldTime }
function TJsonFieldTime.GetFormat: string;
begin
Result := c_TimeFormat;
end;
initialization
RegisterClass(TJsonFieldDateTime);
RegisterClass(TJsonFieldDate);
RegisterClass(TJsonFieldTime);
end.

View File

@ -1,183 +0,0 @@
{******************************************************************************}
{ }
{ Delphi SwagDoc Library }
{ Copyright (c) 2018 Marcelo Jaloto }
{ https://github.com/marcelojaloto/SwagDoc }
{ }
{******************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{******************************************************************************}
unit Json.Schema.Field.Enums;
interface
uses
System.Json,
System.Generics.Collections,
Json.Schema.Field,
Json.Schema.Common.Types;
type
TJsonFieldEnumType = (etNumber, etString);
TJsonFieldEnumItem = class
strict private
fValue: Integer;
fDescription: string;
public
constructor Create(const pValue: Integer; const pDescription: string); reintroduce;
property Value: Integer read fValue;
property Description: string read fDescription;
end;
[ASchemaType(skEnumeration)]
TJsonFieldEnum = class(TJsonField)
strict private
fJsonEnumItems: TObjectList<TJsonFieldEnumItem>;
fEnumType: TJsonFieldEnumType;
function GetCount: Integer;
function GetItem(const pIndex: Byte): TJsonFieldEnumItem;
strict protected
function GetTypeName: string; override;
public
constructor Create; override;
destructor Destroy; override;
procedure AddItem(const pValue: Byte; const pDescription: string);
procedure AddItems(const pItemsDescriptions: array of string);
function ToJsonSchema: TJsonObject; override;
function Clone: TJsonField; override;
property Count: Integer read GetCount;
property Items[const pIndex: Byte]: TJsonFieldEnumItem read GetItem;
property EnumType: TJsonFieldEnumType read fEnumType write fEnumType;
end;
implementation
uses
System.SysUtils,
System.Classes;
{ TJsonFieldEnumItem }
constructor TJsonFieldEnumItem.Create(const pValue: Integer; const pDescription: string);
begin
inherited Create;
fValue := pValue;
fDescription := pDescription;
end;
{ TJsonFieldEnum }
constructor TJsonFieldEnum.Create;
begin
inherited Create;
fJsonEnumItems := TObjectList<TJsonFieldEnumItem>.Create(True);
fEnumType := etNumber;
end;
destructor TJsonFieldEnum.Destroy;
begin
FreeAndNil(fJsonEnumItems);
inherited Destroy;
end;
procedure TJsonFieldEnum.AddItem(const pValue: Byte; const pDescription: string);
begin
fJsonEnumItems.Add(TJsonFieldEnumItem.Create(pValue, pDescription));
end;
procedure TJsonFieldEnum.AddItems(const pItemsDescriptions: array of string);
var
vItemIndex: Integer;
begin
for vItemIndex := 0 to Length(pItemsDescriptions) -1 do
Self.AddItem(vItemIndex, pItemsDescriptions[vItemIndex]);
end;
function TJsonFieldEnum.Clone: TJsonField;
var
vIndex: Integer;
begin
Result := inherited Clone;
TJsonFieldEnum(Result).EnumType := Self.EnumType;
for vIndex := 0 to Self.GetCount - 1 do
begin
TJsonFieldEnum(Result).AddItem(
TJsonFieldEnumItem(fJsonEnumItems[vIndex]).Value,
TJsonFieldEnumItem(fJsonEnumItems[vIndex]).Description);
end;
end;
function TJsonFieldEnum.GetCount: Integer;
begin
Result := fJsonEnumItems.Count;
end;
function TJsonFieldEnum.GetItem(const pIndex: Byte): TJsonFieldEnumItem;
begin
if (pIndex < GetCount) then
Result := TJsonFieldEnumItem(fJsonEnumItems[pIndex])
else
Result := nil;
end;
function TJsonFieldEnum.GetTypeName: string;
begin
case fEnumType of
etNumber: Result := inherited GetTypeName;
etString: Result := 'string';
end;
end;
function TJsonFieldEnum.ToJsonSchema: TJsonObject;
var
vJsonList: TJsonArray;
vCount: Integer;
vJsonEnumItem: TJsonFieldEnumItem;
vHelpEnum: string;
begin
vHelpEnum := 'Enum [';
vJsonList := TJsonArray.Create;
for vCount := 0 to GetCount - 1 do
begin
vJsonEnumItem := GetItem(vCount);
if Assigned(vJsonEnumItem) then
begin
vHelpEnum := vHelpEnum + vJsonEnumItem.Value.ToString + '=' + vJsonEnumItem.Description + ', ';
case fEnumType of
etNumber: vJsonList.Add(vJsonEnumItem.Value);
etString: vJsonList.Add(vJsonEnumItem.Description);
end;
end;
end;
if (fEnumType = etNumber) then
fDescription := fDescription + ' ' + Copy(vHelpEnum, 1, Length(vHelpEnum) - 2) + ']';
Result := inherited ToJsonSchema;
Result.AddPair('enum', vJsonList);
end;
initialization
RegisterClass(TJsonFieldEnum);
end.

View File

@ -1,140 +0,0 @@
{******************************************************************************}
{ }
{ Delphi SwagDoc Library }
{ Copyright (c) 2018 Marcelo Jaloto }
{ https://github.com/marcelojaloto/SwagDoc }
{ }
{******************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{******************************************************************************}
unit Json.Schema.Field.Numbers;
interface
uses
System.Json,
System.Rtti,
Json.Schema.Field,
Json.Schema.Common.Types;
type
TJsonFieldNumber<T> = class abstract (TJsonField)
strict private
fDefaultValue: TValue;
fMinValue: TValue;
fMaxValue: TValue;
fFormat: string;
procedure SetDefaultValue(const Value: T);
procedure SetMaxValue(const Value: T);
procedure SetMinValue(const Value: T);
function GetDefaultValue: T;
function GetMaxValue: T;
function GetMinValue: T;
public
function ToJsonSchema: TJsonObject; override;
function Clone: TJsonField; override;
property MinValue: T read GetMinValue write SetMinValue;
property MaxValue: T read GetMaxValue write SetMaxValue;
property DefaultValue: T read GetDefaultValue write SetDefaultValue;
property Format: string read fFormat write fFormat;
end;
[ASchemaType(skInt64)]
TJsonFieldInt64 = class(TJsonFieldNumber<Int64>)
public
function ToJsonSchema: TJsonObject; override;
end;
[ASchemaType(skInteger)]
TJsonFieldInteger = class(TJsonFieldNumber<Integer>);
[ASchemaType(skNumber)]
TJsonFieldNumber = class(TJsonFieldNumber<Double>);
implementation
uses
System.Classes,
Json.Common.Helpers;
{ TJsonFieldNumber<T> }
function TJsonFieldNumber<T>.Clone: TJsonField;
begin
Result := inherited Clone;
TJsonFieldNumber<T>(Result).fMinValue := Self.fMinValue;
TJsonFieldNumber<T>(Result).fMaxValue := Self.fMaxValue;
TJsonFieldNumber<T>(Result).fDefaultValue := Self.fDefaultValue;
end;
function TJsonFieldNumber<T>.GetDefaultValue: T;
begin
Result := fDefaultValue.AsType<T>;
end;
function TJsonFieldNumber<T>.GetMaxValue: T;
begin
Result := fMaxValue.AsType<T>;
end;
function TJsonFieldNumber<T>.GetMinValue: T;
begin
Result := fMinValue.AsType<T>;
end;
procedure TJsonFieldNumber<T>.SetDefaultValue(const Value: T);
begin
fDefaultValue := TValue.From<T>(Value);
end;
procedure TJsonFieldNumber<T>.SetMaxValue(const Value: T);
begin
fMaxValue := TValue.From<T>(Value);
end;
procedure TJsonFieldNumber<T>.SetMinValue(const Value: T);
begin
fMinValue := TValue.From<T>(Value);
end;
function TJsonFieldNumber<T>.ToJsonSchema: TJsonObject;
begin
Result := inherited ToJsonSchema;
if not fMinValue.IsEmpty then
Result.AddPair('minimum', fMinValue.AsExtended);
if not fMaxValue.IsEmpty then
Result.AddPair('maximum', fMaxValue.AsExtended);
if not fDefaultValue.IsEmpty then
Result.AddPair('default', fDefaultValue.AsExtended);
end;
{ TJsonFieldInt64 }
function TJsonFieldInt64.ToJsonSchema: TJsonObject;
begin
Result := inherited ToJsonSchema;
Result.AddPair('format', 'int64');
end;
initialization
RegisterClass(TJsonFieldInt64);
RegisterClass(TJsonFieldInteger);
RegisterClass(TJsonFieldNumber);
end.

View File

@ -1,185 +0,0 @@
{******************************************************************************}
{ }
{ Delphi SwagDoc Library }
{ Copyright (c) 2018 Marcelo Jaloto }
{ https://github.com/marcelojaloto/SwagDoc }
{ }
{******************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{******************************************************************************}
unit Json.Schema.Field.Objects;
interface
uses
System.Json,
System.Generics.Collections,
Json.Schema.Field,
Json.Schema.Common.Types;
type
[ASchemaType(skObject)]
TJsonFieldObject = class(TJsonField)
strict private
fFields: TObjectList<TJsonField>;
fRef : string;
function GetFieldsCount: Integer;
function GetField(const pFieldIndex: Integer): TJsonField;
function GetFieldByName(const pName: string): TJsonField;
public
constructor Create; override;
destructor Destroy; override;
procedure AddField(pJsonField: TJsonField);
procedure RemoveField(pJsonField: TJsonField); overload;
procedure RemoveField(const pFieldName: string); overload;
procedure CopyFields(pSourceFieldObject: TJsonFieldObject);
function CopyField(pSourceField: TJsonField): TJsonField;
function Clone: TJsonField; overload; override;
function Clone(pSourceField: TJsonFieldObject): TJsonFieldObject; reintroduce; overload;
function ToJsonSchema: TJsonObject; override;
property Fields[const pFieldIndex: Integer]: TJsonField read GetField; default;
property FieldsByName[const pName: string]: TJsonField read GetFieldByName;
property FieldsCount: Integer read GetFieldsCount;
property Ref: string read fRef write fRef;
end;
implementation
uses
System.SysUtils,
System.Classes;
{ TJsonFieldObject }
constructor TJsonFieldObject.Create;
begin
inherited Create;
fFields := TObjectList<TJsonField>.Create(True);
end;
destructor TJsonFieldObject.Destroy;
begin
FreeAndNil(fFields);
inherited Destroy;
end;
function TJsonFieldObject.GetField(const pFieldIndex: Integer): TJsonField;
begin
Result := nil;
if not Assigned(fFields[pFieldIndex]) then
Exit;
Result := TJsonField(fFields[pFieldIndex])
end;
function TJsonFieldObject.GetFieldByName(const pName: string): TJsonField;
begin
Result := nil;
for Result in fFields do
if (UpperCase(Result.Name) = UpperCase(pName)) then
Break;
end;
function TJsonFieldObject.GetFieldsCount: Integer;
begin
Result := fFields.Count;
end;
procedure TJsonFieldObject.RemoveField(pJsonField: TJsonField);
begin
fFields.Remove(pJsonField);
end;
procedure TJsonFieldObject.RemoveField(const pFieldName: string);
begin
RemoveField(GetFieldByName(pFieldName));
end;
procedure TJsonFieldObject.AddField(pJsonField: TJsonField);
begin
fFields.Add(pJsonField);
end;
procedure TJsonFieldObject.CopyFields(pSourceFieldObject: TJsonFieldObject);
var
vIndex: Integer;
begin
for vIndex := 0 to pSourceFieldObject.FieldsCount - 1 do
Self.CopyField(pSourceFieldObject.Fields[vIndex]);
end;
function TJsonFieldObject.CopyField(pSourceField: TJsonField): TJsonField;
begin
Result := pSourceField.Clone;
Self.AddField(Result);
end;
function TJsonFieldObject.Clone: TJsonField;
begin
Result := Self.Clone(Self);
end;
function TJsonFieldObject.Clone(pSourceField: TJsonFieldObject): TJsonFieldObject;
begin
Result := TJsonFieldObject(inherited Clone);
Result.CopyFields(pSourceField);
Result.Ref := pSourceField.Ref;
end;
function TJsonFieldObject.ToJsonSchema: TJsonObject;
const
c_SchemaRef = '$ref';
c_PrefixDefinitionName = '#/definitions/';
var
vJsonObjectList: TJsonObject;
vJsonRequiredList: TJsonArray;
vField: TJsonField;
begin
if (fRef.Length > 0) then
begin
Result := TJSONObject.Create;
Result.AddPair(c_SchemaRef, c_PrefixDefinitionName + fRef);
Exit;
end;
Result := inherited ToJsonSchema;
vJsonRequiredList := TJsonArray.Create;
try
vJsonObjectList := TJsonObject.Create;
for vField in fFields do
begin
vJsonObjectList.AddPair(vField.Name, vField.ToJsonSchema);
if (vField.Required) then
vJsonRequiredList.Add(vField.Name);
end;
if (vJsonRequiredList.Count > 0) then
Result.AddPair('required', vJsonRequiredList);
Result.AddPair('properties', vJsonObjectList);
finally
if (vJsonRequiredList.Count = 0) then
FreeAndNil(vJsonRequiredList);
end;
end;
initialization
RegisterClass(TJsonFieldObject);
end.

View File

@ -1,94 +0,0 @@
{******************************************************************************}
{ }
{ Delphi SwagDoc Library }
{ Copyright (c) 2018 Marcelo Jaloto }
{ https://github.com/marcelojaloto/SwagDoc }
{ }
{******************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{******************************************************************************}
unit Json.Schema.Field.Strings;
interface
uses
System.SysUtils,
System.Json,
Json.Schema.Field,
Json.Schema.Common.Types;
type
[ASchemaType(skString)]
TJsonFieldString = class(TJsonField)
strict private
fMinLength: Integer;
fMaxLength: Integer;
fPattern: string;
fFormat: string;
public
constructor Create; override;
function ToJsonSchema: TJsonObject; override;
function Clone: TJsonField; override;
property MinLength: Integer read fMinLength write fMinLength;
property MaxLength: Integer read fMaxLength write fMaxLength;
property Pattern: String read fPattern write fPattern;
property Format: string read fFormat write fFormat;
end;
[ASchemaType(skGuid)]
TJsonFieldGuid = class(TJsonField);
implementation
uses
System.Classes,
Json.Common.Helpers;
{ TJsonFieldString }
function TJsonFieldString.Clone: TJsonField;
begin
Result := inherited Clone;
TJsonFieldString(Result).MinLength := Self.fMinLength;
TJsonFieldString(Result).MaxLength := Self.fMaxLength;
TJsonFieldString(Result).Pattern := Self.fPattern;
end;
constructor TJsonFieldString.Create;
begin
inherited Create;
fMinLength := 0;
fMaxLength := 0;
fPattern := '';
end;
function TJsonFieldString.ToJsonSchema: TJsonObject;
begin
Result := inherited ToJsonSchema;
if (fMinLength > 0) then
Result.AddPair('minLength', fMinLength);
if (fMaxLength > 0) then
Result.AddPair('maxLength', fMaxLength);
if (fPattern.Length > 0) then
Result.AddPair('pattern', fPattern);
end;
initialization
RegisterClass(TJsonFieldString);
RegisterClass(TJsonFieldGuid);
end.

View File

@ -1,114 +0,0 @@
{******************************************************************************}
{ }
{ Delphi SwagDoc Library }
{ Copyright (c) 2018 Marcelo Jaloto }
{ https://github.com/marcelojaloto/SwagDoc }
{ }
{******************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{******************************************************************************}
unit Json.Schema.Field;
interface
uses
System.Rtti,
System.Classes,
System.Json;
type
TJsonFieldClass = class of TJsonField;
TJsonField = class abstract(TPersistent)
strict private
fTypeName: string;
strict protected
fName: string;
fDescription: string;
fRequired: Boolean;
fNullable: Boolean;
function GetTypeName: string; virtual;
property TypeName: string read GetTypeName;
public
constructor Create; reintroduce; virtual;
function ToJsonSchema: TJsonObject; virtual;
function Clone: TJsonField; virtual;
property Name: string read fName write fName;
property Description: string read fDescription write fDescription;
property Required: Boolean read fRequired write fRequired;
property Nullable: Boolean read fNullable write fNullable;
end;
implementation
uses
System.SysUtils,
Json.Schema.Common.Types;
{ TJsonField }
function TJsonField.Clone: TJsonField;
begin
Result := TJsonField(TJsonFieldClass(FindClass(Self.ClassName)).Create);
Result.Name := Self.fName;
Result.Description := Self.fDescription;
Result.Required := Self.fRequired;
Result.Nullable := Self.fNullable;
end;
constructor TJsonField.Create;
begin
inherited Create;
end;
function TJsonField.GetTypeName: string;
var
vContext: TRttiContext;
vType: TRttiType;
vAttribute: TCustomAttribute;
begin
if not fTypeName.IsEmpty then
begin
Result := fTypeName;
Exit;
end;
vContext := TRttiContext.Create;
vType := vContext.GetType(Self.ClassType);
for vAttribute in vType.GetAttributes do
if vAttribute is ASchemaType then
begin
fTypeName := ASchemaType(vAttribute).Name;
Break;
end;
Result := fTypeName;
end;
function TJsonField.ToJsonSchema: TJsonObject;
begin
Result := TJsonObject.Create;
Result.AddPair('type', GetTypeName);
if not fDescription.IsEmpty then
Result.AddPair('description', fDescription);
end;
end.

View File

@ -1,221 +0,0 @@
{******************************************************************************}
{ }
{ Delphi SwagDoc Library }
{ Copyright (c) 2018 Marcelo Jaloto }
{ https://github.com/marcelojaloto/SwagDoc }
{ }
{******************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{******************************************************************************}
unit Json.Schema;
interface
uses
System.SysUtils,
System.Json,
Json.Schema.Common.Types,
Json.Schema.Field,
Json.Schema.Field.Objects;
type
ETypeNotSupportedByAField = class(Exception);
TJsonSchema = class(TObject)
strict private
fRoot: TJsonFieldObject;
fRef : string;
const c_ErrorTypeNotSupportedByAField = 'Type not supported by a field.';
function GetJsonFieldClass<T>: TJsonFieldClass;
function GetSchemaKind<T>: TSchemaKind;
private
procedure SetRef(const Value: string);
function GetRef: string;
public
constructor Create; reintroduce;
destructor Destroy; override;
function ToJson: TJsonObject;
function Clone: TJsonSchema; overload;
function Clone(pSourceField: TJsonSchema): TJsonSchema; overload;
function AddField<T>(const pName: string; const pDescription: string = ''): TJsonField; overload;
function AddField(pSchemaObject: TJsonSchema): TJsonField; overload;
function AddFieldAsType<T>(const pName: string; const pDescription: string = ''): T;
property Root: TJsonFieldObject read fRoot;
property Ref: string read GetRef write SetRef;
end;
implementation
uses
System.Classes,
System.TypInfo,
System.Rtti,
Json.Schema.Field.Strings,
Json.Schema.Field.Enums,
Json.Schema.Field.Numbers,
Json.Schema.Field.Arrays,
Json.Schema.Field.DateTimes,
Json.Schema.Field.Booleans;
{ TJsonSchema }
constructor TJsonSchema.Create;
begin
inherited Create;
fRoot := TJsonFieldObject.Create;
end;
destructor TJsonSchema.Destroy;
begin
FreeAndNil(fRoot);
inherited Destroy;
end;
function TJsonSchema.GetJsonFieldClass<T>: TJsonFieldClass;
var
vSchemaKind: TSchemaKind;
vClass: TPersistentClass;
begin
Result := nil;
vSchemaKind := GetSchemaKind<T>;
if (vSchemaKind = skUnknown) then
raise ETypeNotSupportedByAField.Create(c_ErrorTypeNotSupportedByAField);
case vSchemaKind of
skObject:
begin
vClass := FindClass(string(PTypeInfo(System.TypeInfo(T))^.Name));
if not vClass.InheritsFrom(TJsonField) then
raise ETypeNotSupportedByAField.Create(c_ErrorTypeNotSupportedByAField);
Result := TJsonFieldClass(vClass);
end;
skInteger: Result := TJsonFieldInteger;
skInt64: Result := TJsonFieldInt64;
skNumber: Result := TJsonFieldNumber;
skDateTime: Result := TJsonFieldDateTime;
skDate: Result := TJsonFieldDate;
skTime: Result := TJsonFieldTime;
skEnumeration: Result := TJsonFieldEnum;
skBoolean: Result := TJsonFieldBoolean;
skArray: Result := TJsonFieldArray;
skString, skChar: Result := TJsonFieldString;
skGuid: Result := TJsonFieldGuid;
else
raise ETypeNotSupportedByAField.Create(c_ErrorTypeNotSupportedByAField);
end;
end;
procedure TJsonSchema.SetRef(const Value: string);
begin
fRoot.Ref := Value;
end;
function TJsonSchema.GetSchemaKind<T>: TSchemaKind;
var
vTypeInfo: PTypeInfo;
vClass: TPersistentClass;
begin
Result := skUnknown;
vTypeInfo := System.TypeInfo(T);
if not Assigned(vTypeInfo) then
Exit;
case vTypeInfo^.Kind of
tkClass: Result := skObject;
tkArray: Result := skArray;
tkString, tkUString, tkChar: Result := skString;
tkRecord:
begin
if (LowerCase(string(vTypeInfo^.Name)) = 'tguid') then
Result := skGuid
end;
tkInteger: Result := skInteger;
tkInt64: Result := skInt64;
tkEnumeration:
begin
if (LowerCase(string(vTypeInfo^.Name)) = 'boolean') then
Result := skBoolean
else
Result := skEnumeration;
end;
tkFloat:
begin
if (LowerCase(string(vTypeInfo^.Name)) = 'tdatetime') then
Result := skDateTime
else if (LowerCase(string(vTypeInfo^.Name)) = 'tdate') then
Result := skDate
else if (LowerCase(string(vTypeInfo^.Name)) = 'ttime') then
Result := skTime
else
Result := skNumber;
end;
end;
end;
function TJsonSchema.GetRef: string;
begin
Result := FRef;
end;
function TJsonSchema.Clone: TJsonSchema;
begin
Result := Self.Clone(Self);
end;
function TJsonSchema.AddField(pSchemaObject: TJsonSchema): TJsonField;
begin
Result := pSchemaObject.Root.Clone;
Self.Root.AddField(Result);
end;
function TJsonSchema.AddField<T>(const pName: string; const pDescription: string = ''): TJsonField;
begin
Result := GetJsonFieldClass<T>.Create;
Result.Name := pName;
Result.Description := pDescription;
fRoot.AddField(Result);
end;
function TJsonSchema.AddFieldAsType<T>(const pName, pDescription: string): T;
var
vValue: TValue;
begin
vValue := AddField<T>(pName, pDescription);
Result := vValue.AsType<T>;
end;
function TJsonSchema.Clone(pSourceField: TJsonSchema): TJsonSchema;
begin
Result := TJsonSchema.Create;
Result.Root.CopyFields(pSourceField.Root);
Result.Root.Ref := pSourceField.Root.Ref;
end;
function TJsonSchema.ToJson: TJsonObject;
begin
if fRef.Length = 0 then
Result := fRoot.ToJsonSchema
else
begin
Result := TJSONObject.Create;
Result.AddPair('$ref', fRef);
end;
end;
end.

View File

@ -1,43 +0,0 @@
{******************************************************************************}
{ }
{ Delphi SwagDoc Library }
{ Copyright (c) 2018 Marcelo Jaloto }
{ https://github.com/marcelojaloto/SwagDoc }
{ }
{******************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{******************************************************************************}
unit Swag.Common.Consts;
interface
uses
Swag.Common.Types;
const
c_SwaggerFileName = 'swagger.json';
c_SwaggerVersion = '2.0';
c_SwagTransferProtocolScheme: array[TSwagTransferProtocolScheme] of string = ('', 'http', 'https', 'ws', 'wss');
c_SwagSecurityDefinitionType: array[TSwagSecurityDefinitionType] of string = ('', 'basic', 'apiKey', 'oauth2');
c_SwagPathOperationHttpVerbs: array[TSwagPathTypeOperation] of string =
('', 'get', 'post', 'put', 'delete', 'options', 'head', 'patch', 'trace');
c_SwagRequestParameterInLocation: array[TSwagRequestParameterInLocation] of string =
('', 'query', 'header', 'path', 'formData', 'body');
c_SwagTypeParameter: array[TSwagTypeParameter] of string = ('', 'string', 'number', 'integer', 'boolean', 'array', 'file');
implementation
end.

View File

@ -1,158 +0,0 @@
{******************************************************************************}
{ }
{ Delphi SwagDoc Library }
{ Copyright (c) 2018 Marcelo Jaloto }
{ https://github.com/marcelojaloto/SwagDoc }
{ }
{******************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{******************************************************************************}
unit Swag.Common.Types.Helpers;
interface
uses
Swag.Common.Types;
type
TSwagPathTypeOperationHelper = record helper for TSwagPathTypeOperation
public
procedure ToType(const pHttpVerbString: string);
end;
TSwagRequestParameterInLocationHelper = record helper for TSwagRequestParameterInLocation
public
procedure ToType(const pInLocationString: string);
end;
TSwagTransferProtocolSchemeHelper = record helper for TSwagTransferProtocolScheme
public
procedure ToType(const pTransferProtocolSchemeString: string);
end;
TSwagSecurityDefinitionTypeHelper = record helper for TSwagSecurityDefinitionType
public
procedure ToType(const pSecurityDefinitionTypeString: string);
end;
TSwagTransferProtocolSchemesHelper = record helper for TSwagTransferProtocolSchemes
public
procedure Add(const pScheme: TSwagTransferProtocolScheme); overload;
procedure Add(const pSchemeString: string); overload;
end;
TSwagTypeParameterHelper = record helper for TSwagTypeParameter
public
procedure ToType(const pTypeParameter: string);
end;
implementation
uses
System.SysUtils,
Swag.Common.Consts;
{ TSwagPathTypeOperationHelper }
procedure TSwagPathTypeOperationHelper.ToType(const pHttpVerbString: string);
var
vPathTypeOperation: TSwagPathTypeOperation;
begin
Self := ohvNotDefined;
for vPathTypeOperation := Low(TSwagPathTypeOperation) to High(TSwagPathTypeOperation) do
if (LowerCase(c_SwagPathOperationHttpVerbs[vPathTypeOperation]) = LowerCase(pHttpVerbString)) then
begin
Self := vPathTypeOperation;
Break;
end;
end;
{ TSwagRequestParameterInLocationHelper }
procedure TSwagRequestParameterInLocationHelper.ToType(const pInLocationString: string);
var
vRequestParameterInLocation: TSwagRequestParameterInLocation;
begin
Self := rpiNotDefined;
for vRequestParameterInLocation := Low(TSwagRequestParameterInLocation) to High(TSwagRequestParameterInLocation) do
if (LowerCase(c_SwagRequestParameterInLocation[vRequestParameterInLocation]) = LowerCase(pInLocationString)) then
begin
Self := vRequestParameterInLocation;
Break;
end;
end;
{ TSwagTransferProtocolSchemeHelper }
procedure TSwagTransferProtocolSchemeHelper.ToType(const pTransferProtocolSchemeString: string);
var
vTransferProtocolScheme: TSwagTransferProtocolScheme;
begin
Self := tpsNotDefined;
for vTransferProtocolScheme := Low(TSwagTransferProtocolScheme) to High(TSwagTransferProtocolScheme) do
if (LowerCase(c_SwagTransferProtocolScheme[vTransferProtocolScheme]) = LowerCase(pTransferProtocolSchemeString)) then
begin
Self := vTransferProtocolScheme;
Break;
end;
end;
{ TSwagTransferProtocolSchemesHelper }
procedure TSwagTransferProtocolSchemesHelper.Add(const pScheme: TSwagTransferProtocolScheme);
begin
Self := Self + [pScheme];
end;
procedure TSwagTransferProtocolSchemesHelper.Add(const pSchemeString: string);
var
vScheme: TSwagTransferProtocolScheme;
begin
vScheme.ToType(pSchemeString);
Self.Add(vScheme);
end;
{ TSwagTypeParameterHelper }
procedure TSwagTypeParameterHelper.ToType(const pTypeParameter: string);
var
vSwagTypeParameter: TSwagTypeParameter;
begin
Self := stpNotDefined;
for vSwagTypeParameter := Low(TSwagTypeParameter) to High(TSwagTypeParameter) do
if (LowerCase(c_SwagTypeParameter[vSwagTypeParameter]) = LowerCase(pTypeParameter)) then
begin
Self := vSwagTypeParameter;
Break;
end;
end;
{ TSwagSecurityDefinitionTypeHelper }
procedure TSwagSecurityDefinitionTypeHelper.ToType(const pSecurityDefinitionTypeString: string);
var
vSecurityDefinitionType: TSwagSecurityDefinitionType;
begin
Self := ssdNotDefined;
for vSecurityDefinitionType := Low(TSwagSecurityDefinitionType) to High(TSwagSecurityDefinitionType) do
if (LowerCase(c_SwagSecurityDefinitionType[vSecurityDefinitionType]) = LowerCase(pSecurityDefinitionTypeString.Trim)) then
begin
Self := vSecurityDefinitionType;
Break;
end;
end;
end.

View File

@ -1,111 +0,0 @@
{******************************************************************************}
{ }
{ Delphi SwagDoc Library }
{ Copyright (c) 2018 Marcelo Jaloto }
{ https://github.com/marcelojaloto/SwagDoc }
{ }
{******************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{******************************************************************************}
unit Swag.Common.Types;
interface
uses
System.Generics.Collections;
type
TSwagStatusCode = string;
TSwagMimeType = string;
TSwagJsonExampleDescription = string;
TSwagSecuritySchemeName = string;
/// <summary>
/// Allows the definition of a security scheme that can be used by the operations.
/// Supported schemes are:
/// * basic authentication
/// * API key (either as a header or as a query parameter)
/// * OAuth2's common flows (implicit, password, application and access code).
/// </summary>
TSwagSecurityDefinitionType = (ssdNotDefined, ssdBasic, ssdApiKey, ssdOAuth2);
TSwagSecurityDefinitionsType = set of TSwagSecurityDefinitionType;
TSwagSecurityScopesSchemaName = string;
TSwagSecurityScopesSchemaDescription = string;
TSwagSecurityScopes = TDictionary<TSwagSecurityScopesSchemaName, TSwagSecurityScopesSchemaDescription>;
/// <summary>
/// The transfer protocol of the API. Values MUST be from the list: "http", "https", "ws", "wss".
/// </summary>
TSwagTransferProtocolScheme = (tpsNotDefined, tpsHttp, tpsHttps, tpsWs, tpsWss);
TSwagTransferProtocolSchemes = set of TSwagTransferProtocolScheme;
/// <summary>
/// * Query - Parameters that are appended to the URL. For example, in /items?id=###, the query parameter is id.
/// * Header - Custom headers that are expected as part of the request.
/// * Path - Used together with Path Templating, where the parameter value is actually part of the operation's URL.
/// This does not include the host or base path of the API. For example, in /items/{itemId}, the path parameter is itemId.
/// * Form - Used to describe the payload of an HTTP request when either application/x-www-form-urlencoded, multipart/form-data
/// or both are used as the content type of the request (in Swagger's definition, the consumes property of an operation).
/// This is the only parameter type that can be used to send files, thus supporting the file type.
/// Since form parameters are sent in the payload, they cannot be declared together with a body parameter for the same
/// operation. Form parameters have a different format based on the content-type used (for further details,
/// consult http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4).
/// * Body - The payload that's appended to the HTTP request. Since there can only be one payload, there can only be one body parameter.
/// The name of the body parameter has no effect on the parameter itself and is used for documentation purposes only.
/// Since Form parameters are also in the payload, body and form parameters cannot exist together for the same operation.
/// </summary>
TSwagRequestParameterInLocation = (rpiNotDefined, rpiQuery, rpiHeader, rpiPath, rpiFormData, rpiBody);
TSwagPathTypeOperation = (ohvNotDefined, ohvGet, ohvPost, ohvPut, ohvDelete, ohvOptions, ohvHead, ohvPatch, ohvTrace);
/// <summary>
/// The type of the parameter. Since the parameter is not located at the request body, it is limited to
/// simple types (that is, not an object).
/// The value MUST be one of "string", "number", "integer", "boolean", "array" or "file".
/// </summary>
TSwagTypeParameter = (stpNotDefined, stpString, stpNumber, stpInteger, stpBoolean, stpArray, stpFile);
ASecurityDefinition = class(TCustomAttribute)
strict private
fDefinition: TSwagSecurityDefinitionType;
function GetName: string;
public
constructor Create(const pDefinition: TSwagSecurityDefinitionType);
property Definition: TSwagSecurityDefinitionType read fDefinition;
property Name: string read GetName;
end;
implementation
uses
Swag.Common.Consts;
{ ASecurityDefinition }
constructor ASecurityDefinition.Create(const pDefinition: TSwagSecurityDefinitionType);
begin
inherited Create;
fDefinition := pDefinition;
end;
function ASecurityDefinition.GetName: string;
begin
Result := c_SwagSecurityDefinitionType[fDefinition];
end;
end.

View File

@ -1,103 +0,0 @@
{******************************************************************************}
{ }
{ Delphi SwagDoc Library }
{ Copyright (c) 2018 Marcelo Jaloto }
{ https://github.com/marcelojaloto/SwagDoc }
{ }
{******************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{******************************************************************************}
unit Swag.Doc.Definition;
interface
uses
Json.Schema,
System.JSON;
type
/// <summary>
/// The Schema Object allows the definition of input and output data types.
/// These types can be objects, but also primitives and arrays.
/// This object is based on the JSON Schema Specification Draft 4 and uses a predefined subset of it.
/// On top of this subset, there are extensions provided by this specification to allow for more complete documentation.
/// Further information about the properties can be found in JSON Schema Core and JSON Schema Validation.
/// Unless stated otherwise, the property definitions follow the JSON Schema specification as referenced here.
/// </summary>
TSwagDefinition = class(TObject)
private
fName: string;
fJsonSchema: TJsonObject;
procedure SetName(const pValue: string);
procedure SetJsonSchema(const pValue: TJsonObject);
function GetJsonSchema: TJsonObject;
public
destructor Destroy; override;
function GenerateJsonRefDefinition: TJsonObject;
/// <summary>
/// The schema name alias.
/// </summary>
property Name: string read fName write SetName;
/// <summary>
/// See more in:
/// * http://json-schema.org
/// * https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#schemaObject
/// </summary>
property JsonSchema: TJsonObject read GetJsonSchema write SetJsonSchema;
end;
implementation
uses
System.SysUtils;
{ TSwagDefinition }
destructor TSwagDefinition.Destroy;
begin
if Assigned(fJsonSchema) then
FreeAndNil(fJsonSchema);
inherited Destroy;
end;
function TSwagDefinition.GetJsonSchema: TJsonObject;
begin
Result := fJsonSchema;
end;
procedure TSwagDefinition.SetJsonSchema(const pValue: TJsonObject);
begin
fJsonSchema := pValue;
fJsonSchema.Owned := False;
end;
procedure TSwagDefinition.SetName(const pValue: string);
begin
fName := pValue;
end;
function TSwagDefinition.GenerateJsonRefDefinition: TJsonObject;
const
c_SchemaRef = '$ref';
c_PrefixDefinitionName = '#/definitions/';
begin
Result := TJsonObject.Create;
Result.AddPair(c_SchemaRef, c_PrefixDefinitionName + fName);
end;
end.

View File

@ -1,201 +0,0 @@
{******************************************************************************}
{ }
{ Delphi SwagDoc Library }
{ Copyright (c) 2018 Marcelo Jaloto }
{ https://github.com/marcelojaloto/SwagDoc }
{ }
{******************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{******************************************************************************}
unit Swag.Doc.FileLoader;
interface
uses
Swag.Doc;
type
TSwagFileLoader = class(TObject)
strict private
fSwagDoc: TSwagDoc;
public
constructor Create(pSwagDocTarget: TSwagDoc);
procedure Load(const pFilename: string);
end;
implementation
uses
System.SysUtils,
System.Generics.Collections,
System.JSON,
System.IOUtils,
System.Classes,
Swag.Common.Types,
Swag.Common.Types.Helpers,
Swag.Doc.Path,
Swag.Doc.Tags,
Swag.Doc.SecurityDefinition,
Swag.Doc.Definition,
Swag.Doc.Path.Operation.RequestParameter;
{ TSwagFileLoader }
constructor TSwagFileLoader.Create(pSwagDocTarget: TSwagDoc);
begin
inherited Create;
fSwagDoc := pSwagDocTarget;
end;
procedure TSwagFileLoader.Load(const pFilename: string);
var
vSwaggerJson: TJSONValue;
vJsonObj: TJSONObject;
vPath: TSwagPath;
vJsonTagsArray: TJSONArray;
vTag: TSwagTag;
vJsonSchemesArray: TJSONArray;
vJsonProduces: TJSONArray;
vJsonConsumes: TJSONArray;
vJsonDefinitions: TJSONObject;
vDefinition: TSwagDefinition;
vJsonParameters: TJSONObject;
vParameter: TSwagRequestParameter;
vJsonSecurityDefinitions: TJSONObject;
vJsonSecurityDefinitionItem: TJSONObject;
vSecurityDefinitionClass: TPersistentClass;
vSecurityDefinitionType: TSwagSecurityDefinitionType;
vSecurityDefinition: TSwagSecurityDefinition;
vJsonExternalDocs: TJSONObject;
vIndex: Integer;
begin
if not FileExists(pFilename) then
raise ESwagErrorLoadSwaggerJsonFile.Create('File doesn''t exist ['+pFilename+']');
vSwaggerJson := TJSONObject.ParseJSONValue(TFile.ReadAllText(pFilename)) as TJSONObject;
try
if not Assigned(vSwaggerJson) then
raise ESwagErrorLoadSwaggerJsonFile.Create('File could not be loaded ['+pFilename+']');
fSwagDoc.Info.Load((vSwaggerJson as TJSONObject).Values[c_SwagInfo] as TJSONObject);
vJsonTagsArray := (vSwaggerJson as TJSONObject).Values[c_SwagTags] as TJSONArray;
if Assigned(vJsonTagsArray) then
for vIndex := 0 to vJsonTagsArray.Count - 1 do
begin
vTag := TSwagTag.Create;
vTag.Load(vJsonTagsArray.Items[vIndex] as TJSONObject);
fSwagDoc.Tags.Add(vTag);
end;
vJsonObj := (vSwaggerJson as TJSONObject).Values[c_SwagPaths] as TJSONObject;
vJsonSchemesArray := (vSwaggerJson as TJSONObject).Values[c_SwagSchemes] as TJSONArray;
if Assigned(vJsonSchemesArray) then
for vIndex := 0 to vJsonSchemesArray.Count - 1 do
begin
fSwagDoc.Schemes.Add(vJsonSchemesArray.Items[vIndex].Value);
end;
if Assigned((vSwaggerJson as TJSONObject).Values[c_SwagHost]) then
fSwagDoc.Host := (vSwaggerJson as TJSONObject).Values[c_SwagHost].Value
else
fSwagDoc.Host := EmptyStr;
if Assigned((vSwaggerJson as TJSONObject).Values[c_SwagBasePath]) then
fSwagDoc.BasePath := (vSwaggerJson as TJSONObject).Values[c_SwagBasePath].Value
else
fSwagDoc.BasePath := EmptyStr;
for vIndex := 0 to vJsonObj.Count - 1 do
begin
vPath := TSwagPath.Create;
vPath.Uri := vJsonObj.Pairs[vIndex].JSONString.Value;
vPath.Load((vJsonObj.Pairs[vIndex].JsonValue) as TJSONObject);
fSwagDoc.Paths.Add(vPath);
end;
vJsonProduces := (vSwaggerJson as TJSONObject).Values[c_SwagProduces] as TJSONArray;
if Assigned(vJsonProduces) then
for vIndex := 0 to vJsonProduces.Count - 1 do
begin
fSwagDoc.Produces.Add(vJsonProduces.Items[vIndex].Value);
end;
vJsonConsumes := (vSwaggerJson as TJSONObject).Values[c_SwagConsumes] as TJSONArray;
if Assigned(vJsonConsumes) then
for vIndex := 0 to vJsonConsumes.count - 1 do
begin
fSwagDoc.Consumes.Add(vJsonConsumes.Items[vIndex].Value);
end;
vJsonDefinitions := (vSwaggerJson as TJSONObject).Values[c_SwagDefinitions] as TJSONObject;
if Assigned(vJsonDefinitions) then
for vIndex := 0 to vJsonDefinitions.Count - 1 do
begin
vDefinition := TSwagDefinition.Create;
vDefinition.Name := (vJsonDefinitions.Pairs[vIndex] as TJSONPair).JsonString.Value;
vDefinition.JsonSchema := ((vJsonDefinitions.Pairs[vIndex] as TJSONPair).JsonValue.Clone as TJSONObject);
fSwagDoc.Definitions.Add(vDefinition);
end;
vJsonParameters := (vSwaggerJson as TJSONObject).Values[c_SwagParameters] as TJSONObject;
if Assigned(vJsonParameters) then
for vIndex := 0 to vJsonParameters.Count - 1 do
begin
vParameter := TSwagRequestParameter.Create;
vParameter.Name := (vJsonParameters.Pairs[vIndex] as TJSONPair).JsonString.Value;
vParameter.Load((vJsonParameters.Pairs[vIndex] as TJSONPair).JsonValue as TJSONObject);
fSwagDoc.Parameters.Add(vParameter);
end;
{ TODO : test... }
vJsonSecurityDefinitions := (vSwaggerJson as TJSONObject).Values[c_SwagSecurityDefinitions] as TJSONObject;
if Assigned(vJsonSecurityDefinitions) then
for vIndex := 0 to vJsonSecurityDefinitions.Count - 1 do
begin
vJsonSecurityDefinitionItem := vJsonSecurityDefinitions.Pairs[vIndex].JsonValue as TJSONObject;
if not Assigned(vJsonSecurityDefinitionItem) or
not Assigned(vJsonSecurityDefinitionItem.Values[c_SwagSecurityDefinitionsType]) or
vJsonSecurityDefinitionItem.Values[c_SwagSecurityDefinitionsType].Value.Trim.IsEmpty then
Continue;
vSecurityDefinitionType.ToType(vJsonSecurityDefinitionItem.Values[c_SwagSecurityDefinitionsType].Value);
vSecurityDefinitionClass := TSwagGetClassSecurityDefinition.Find(vSecurityDefinitionType);
if Assigned(vSecurityDefinitionClass) then
begin
vSecurityDefinition := TSwagSecurityDefinition(vSecurityDefinitionClass).Create;
vSecurityDefinition.SchemeName := (vJsonSecurityDefinitions.Pairs[vIndex] as TJSONPair).JsonString.Value;
vSecurityDefinition.Load((vJsonSecurityDefinitions.Pairs[vIndex] as TJSONPair).JsonValue as TJSONObject);
fSwagDoc.SecurityDefinitions.Add(vSecurityDefinition);
end;
end;
vJsonExternalDocs := (vSwaggerJson as TJSONObject).Values[c_SwagExternalDocs] as TJSONObject;
if Assigned(vJsonExternalDocs) then
begin
if Assigned(vJsonExternalDocs.Values[c_SwagExternalDocsUrl]) then
fSwagDoc.ExternalDocs.Url := vJsonExternalDocs.Values[c_SwagExternalDocsUrl].Value;
if Assigned(vJsonExternalDocs.Values[c_SwagExternalDocsDescription]) then
fSwagDoc.ExternalDocs.Description := vJsonExternalDocs.Values[c_SwagExternalDocsDescription].Value;
end;
finally
vSwaggerJson.Free;
end;
end;
end.

View File

@ -1,96 +0,0 @@
{******************************************************************************}
{ }
{ Delphi SwagDoc Library }
{ Copyright (c) 2018 Marcelo Jaloto }
{ https://github.com/marcelojaloto/SwagDoc }
{ }
{******************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{******************************************************************************}
unit Swag.Doc.Info.Contact;
interface
uses
System.JSON;
type
/// <summary>
/// Contact information for the exposed API.
/// </summary>
TSwagInfoContact = class(TObject)
private
fName: string;
fEmail: string;
fUrl: string;
public
function GenerateJsonObject: TJSONObject;
function IsEmpty: Boolean;
procedure Load(pJson: TJSONObject);
/// <summary>
/// The identifying name of the contact person/organization.
/// </summary>
property Name: string read fName write fName;
/// <summary>
/// The URL pointing to the contact information. MUST be in the format of a URL.
/// </summary>
property Email: string read fEmail write fEmail;
/// <summary>
/// The email address of the contact person/organization. MUST be in the format of an email address.
/// </summary>
property Url: string read fUrl write fUrl;
end;
implementation
uses System.SysUtils;
const
c_SwagInfoContactName = 'name';
c_SwagInfoContactEmail = 'email';
c_SwagInfoContactUrl = 'url';
{ TSwagInfoContact }
function TSwagInfoContact.GenerateJsonObject: TJSONObject;
begin
Result := TJsonObject.Create;
Result.AddPair(c_SwagInfoContactName, fName);
Result.AddPair(c_SwagInfoContactEmail, fEmail);
Result.AddPair(c_SwagInfoContactUrl, fUrl);
end;
function TSwagInfoContact.IsEmpty: Boolean;
begin
Result := fName.IsEmpty and fEmail.IsEmpty and fUrl.IsEmpty;
end;
procedure TSwagInfoContact.Load(pJson: TJSONObject);
begin
if Assigned(pJson.Values[c_SwagInfoContactName]) then
fName := pJson.Values[c_SwagInfoContactName].Value;
if Assigned(pJson.Values[c_SwagInfoContactEmail]) then
fEmail := pJson.Values[c_SwagInfoContactEmail].Value;
if Assigned(pJson.Values[c_SwagInfoContactUrl]) then
fUrl := pJson.Values[c_SwagInfoContactUrl].Value;
end;
end.

View File

@ -1,89 +0,0 @@
{******************************************************************************}
{ }
{ Delphi SwagDoc Library }
{ Copyright (c) 2018 Marcelo Jaloto }
{ https://github.com/marcelojaloto/SwagDoc }
{ }
{******************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{******************************************************************************}
unit Swag.Doc.Info.License;
interface
uses
System.JSON;
type
/// <summary>
/// License information for the exposed API.
/// </summary>
TSwagInfoLicense = class(TObject)
private
fName: string;
fUrl: string;
public
function GenerateJsonObject: TJsonObject;
procedure Load(pJson: TJsonObject);
function isEmpty: Boolean;
/// <summary>
/// Required. The license name used for the API.
/// </summary>
property Name: string read fName write fName;
/// <summary>
/// A URL to the license used for the API. MUST be in the format of a URL.
/// </summary>
property Url: string read fUrl write fUrl;
end;
implementation
uses
System.SysUtils;
const
c_SwagInfoLicenseName = 'name';
c_SwagInfoLicenseUrl = 'url';
{ TSwagInfoLicense }
function TSwagInfoLicense.GenerateJsonObject: TJsonObject;
begin
Result := TJsonObject.Create;
Result.AddPair(c_SwagInfoLicenseName, fName);
Result.AddPair(c_SwagInfoLicenseUrl, fUrl);
end;
function TSwagInfoLicense.isEmpty: Boolean;
begin
Result := fName.IsEmpty and fUrl.IsEmpty;
end;
procedure TSwagInfoLicense.Load(pJson: TJsonObject);
begin
if not Assigned(pJson) then
Exit;
if Assigned(pJson.Values[c_SwagInfoLicenseName]) then
fName := pJson.Values[c_SwagInfoLicenseName].Value;
if Assigned(pJson.Values[c_SwagInfoLicenseUrl]) then
fUrl := pJson.Values[c_SwagInfoLicenseUrl].Value;
end;
end.

View File

@ -1,147 +0,0 @@
{******************************************************************************}
{ }
{ Delphi SwagDoc Library }
{ Copyright (c) 2018 Marcelo Jaloto }
{ https://github.com/marcelojaloto/SwagDoc }
{ }
{******************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{******************************************************************************}
unit Swag.Doc.Info;
interface
uses
System.JSON,
Swag.Doc.Info.License,
Swag.Doc.Info.Contact;
type
/// <summary>
/// The object provides metadata about the API.
/// The metadata can be used by the clients if needed, and can be presented in the Swagger-UI for convenience.
/// </summary>
TSwagInfo = class(TObject)
private
fVersion: string;
fTitle: string;
fDescription: string;
fContact: TSwagInfoContact;
fTermsOfService: string;
fLicense: TSwagInfoLicense;
public
constructor Create; reintroduce;
destructor Destroy; override;
function GenerateJsonObject: TJSONObject;
procedure Load(pJson: TJSONObject);
/// <summary>
/// Required. The title of the application.
/// </summary>
property Title: string read fTitle write fTitle;
/// <summary>
/// A short description of the application. GFM syntax can be used for rich text representation.
/// </summary>
property Description: string read fDescription write fDescription;
/// <summary>
/// The Terms of Service for the API.
/// </summary>
property TermsOfService: string read fTermsOfService write fTermsOfService;
/// <summary>
/// The contact information for the exposed API.
/// </summary>
property Contact: TSwagInfoContact read fContact write fContact;
/// <summary>
/// The license information for the exposed API.
/// </summary>
property License: TSwagInfoLicense read fLicense;
/// <summary>
/// Required Provides the version of the application API (not to be confused with the specification version).
/// </summary>
property Version: string read fVersion write fVersion;
end;
implementation
uses
System.SysUtils;
const
c_SwagInfoVersion = 'version';
c_SwagInfoTitle = 'title';
c_SwagInfoDescription = 'description';
c_SwagInfoContact = 'contact';
c_SwagInfoTermsOfService = 'termsOfService';
c_SwagLicense = 'license';
{ TSwagInfo }
procedure TSwagInfo.Load(pJson: TJSONObject);
begin
if Assigned(pJson.Values[c_SwagInfoVersion]) then
fVersion := pJson.Values[c_SwagInfoVersion].Value;
if Assigned(pJson.Values[c_SwagInfoTitle]) then
fTitle := pJson.Values[c_SwagInfoTitle].Value;
if Assigned(pJson.Values[c_SwagInfoDescription]) then
fDescription := pJson.Values[c_SwagInfoDescription].Value;
if Assigned(pJson.Values[c_SwagInfoTermsOfService]) then
FTermsOfService := pJson.Values[c_SwagInfoTermsOfService].Value;
if Assigned(pJson.Values[c_SwagInfoContact]) then
fContact.Load(pJson.Values[c_SwagInfoContact] as TJSONObject);
fLicense.Load((pJson as TJSONObject).Values[c_SwagLicense] as TJSONObject);
end;
constructor TSwagInfo.Create;
begin
inherited Create;
fContact := TSwagInfoContact.Create;
fLicense := TSwagInfoLicense.Create;
end;
destructor TSwagInfo.Destroy;
begin
FreeAndNil(fContact);
FreeAndNil(fLicense);
inherited Destroy;
end;
function TSwagInfo.GenerateJsonObject: TJSONObject;
begin
Result := TJsonObject.Create;
Result.AddPair(c_SwagInfoVersion, fVersion);
Result.AddPair(c_SwagInfoTitle, fTitle);
Result.AddPair(c_SwagInfoDescription, fDescription);
if not fTermsOfService.IsEmpty then
Result.AddPair(c_SwagInfoTermsOfService, fTermsOfService);
if not fContact.IsEmpty then
Result.AddPair(c_SwagInfoContact, fContact.GenerateJsonObject);
if not fLicense.isEmpty then
Result.AddPair(c_SwagLicense,fLicense.GenerateJsonObject);
end;
end.

View File

@ -1,299 +0,0 @@
{******************************************************************************}
{ }
{ Delphi SwagDoc Library }
{ Copyright (c) 2018 Marcelo Jaloto }
{ https://github.com/marcelojaloto/SwagDoc }
{ }
{******************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{******************************************************************************}
unit Swag.Doc.Path.Operation.RequestParameter;
interface
uses
System.SysUtils,
System.Classes,
System.Generics.Collections,
System.JSON,
Swag.Common.Types,
Swag.Doc.Definition;
type
/// <summary>
/// Describes a single operation parameter.
/// A unique parameter is defined by a combination of a name and location.
/// </summary>
TSwagRequestParameter = class(TObject)
private
fName: string;
fInLocation: TSwagRequestParameterInLocation;
fRequired: Boolean;
fSchema: TSwagDefinition;
fDescription: string;
fTypeParameter: TSwagTypeParameter;
fPattern: string;
fItems: TJSONObject;
fFormat: string;
fDefault: string;
fEnum: TStringList;
fAllowEmptyValue: Boolean;
fRef: string;
procedure SetAllowEmptyValue(const pValue: Boolean);
protected
function ReturnInLocationToString: string;
public
constructor Create; reintroduce;
destructor Destroy; override;
function GenerateJsonObject: TJSONObject;
procedure Load(pJson: TJSONObject);
/// <summary>
/// There are five possible parameter types: Query, Header, Path, Form e Body.
/// </summary>
property InLocation: TSwagRequestParameterInLocation read fInLocation write fInLocation;
/// <summary>
/// Required. The name of the parameter. Parameter names are case sensitive.
/// If in is "path", the name field MUST correspond to the associated path segment from the path field in the Paths Object.
/// See Path Templating for further information.
/// For all other cases, the name corresponds to the parameter name used based on the in property.
/// </summary>
property Name: string read fName write fName;
/// <summary>
/// A brief description of the parameter. This could contain examples of use. GFM syntax can be used for rich text representation.
/// </summary>
property Description: string read fDescription write fDescription;
/// <summary>
/// Determines whether this parameter is mandatory. If the parameter is in "path", this property is required and its value MUST be true.
/// Otherwise, the property MAY be included and its default value is false.
/// </summary>
property Required: Boolean read fRequired write fRequired;
/// <summary>
/// See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.3.
/// </summary>
property Pattern: string read fPattern write fPattern;
/// <summary>
/// If in is "body"
/// Required. The schema defining the type used for the body parameter.
/// </summary>
property Schema: TSwagDefinition read fSchema;
property Items: TJSONObject read fItems;
/// <summary>
/// If in is any value other than "body"
/// Required. The type of the parameter. Since the parameter is not located at the request body, it is limited to
/// simple types (that is, not an object).
/// The value MUST be one of "string", "number", "integer", "boolean", "array" or "file".
/// If type is "file", the consumes MUST be either "multipart/form-data", " application/x-www-form-urlencoded" or both
/// and the parameter MUST be in "formData".
/// </summary>
property TypeParameter: TSwagTypeParameter read fTypeParameter write fTypeParameter;
/// <summary>
/// Primitives have an optional modifier property format. Swagger uses several known formats to more finely define
/// the data type being used. However, the format property is an open string-valued property, and can have any value
/// to support documentation needs. Formats such as "email", "uuid", etc., can be used even though they are not
/// defined by this specification.
/// </summary>
property Format: string read fFormat write fFormat;
/// <summary>
/// Declares the value of the parameter that the server will use if none is provided, for example a "count" to
/// control the number of results per page might default to 100 if not supplied by the client in the request.
/// (Note: "default" has no meaning for required parameters.)
/// See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-6.2. Unlike JSON Schema
/// this value MUST conform to the defined type for this parameter.
property Default: string read fDefault write fDefault;
property Enum: TStringList read fEnum;
property AllowEmptyValue: Boolean read fAllowEmptyValue write SetAllowEmptyValue;
property Ref: string read fRef write fRef;
end;
implementation
uses
System.StrUtils,
Swag.Common.Consts,
Swag.Common.Types.Helpers;
const
c_SwagRequestParameterIn = 'in';
c_SwagRequestParameterName = 'name';
c_SwagRequestParameterDescription = 'description';
c_SwagRequestParameterRequired = 'required';
c_SwagRequestParameterSchema = 'schema';
c_SwagRequestParameterType = 'type';
c_SwagRequestParameterDefault = 'default';
c_SwagRequestParameterPattern = 'pattern';
c_SwagRequestParameterFormat = 'format';
c_SwagRequestParameterEnum = 'enum';
c_SwagRequestParameterAllowEmptyValue = 'allowEmptyValue';
c_SwagRequestParameterRef = '$ref';
{ TSwagRequestParameter }
constructor TSwagRequestParameter.Create;
begin
inherited Create;
fSchema := TSwagDefinition.Create;
fEnum := TStringList.Create;
end;
destructor TSwagRequestParameter.Destroy;
begin
FreeAndNil(fSchema);
FreeAndNil(fEnum);
inherited Destroy;
end;
function TSwagRequestParameter.GenerateJsonObject: TJSONObject;
var
vJsonObject: TJsonObject;
vJsonEnum: TJSONArray;
vIndex: Integer;
begin
vJsonObject := TJsonObject.Create;
if fRef.Length > 0 then
begin
vJsonObject.AddPair('$ref', fRef);
Result := vJsonObject;
Exit;
end;
vJsonObject.AddPair(c_SwagRequestParameterIn, ReturnInLocationToString);
vJsonObject.AddPair(c_SwagRequestParameterName, fName);
if not fDescription.IsEmpty then
vJsonObject.AddPair(c_SwagRequestParameterDescription, fDescription);
if not fPattern.IsEmpty then
vJsonObject.AddPair(c_SwagRequestParameterPattern, fPattern);
if not fDefault.IsEmpty then
vJsonObject.AddPair(c_SwagRequestParameterDefault, fDefault);
if fRequired or (fInLocation = rpiPath) then
vJsonObject.AddPair(c_SwagRequestParameterRequired, TJSONBool.Create(True));
if fAllowEmptyValue and (fInLocation = rpiQuery) or (fInLocation = rpiFormData) then
vJsonObject.AddPair(c_SwagRequestParameterAllowEmptyValue, TJSONBool.Create(True));
if fInLocation = rpiBody then // schema only allow in body parameters
begin
if (not fSchema.Name.IsEmpty) then
vJsonObject.AddPair(c_SwagRequestParameterSchema, fSchema.GenerateJsonRefDefinition)
else if Assigned(fSchema.JsonSchema) then
vJsonObject.AddPair(c_SwagRequestParameterSchema, fSchema.JsonSchema.Clone as TJSONObject);
end;
if (fTypeParameter <> stpNotDefined) then
vJsonObject.AddPair(c_SwagRequestParameterType, c_SwagTypeParameter[fTypeParameter]);
if not fFormat.IsEmpty then
vJsonObject.AddPair(c_SwagRequestParameterFormat, fFormat);
if fEnum.Count > 0 then
begin
vJsonEnum := TJSONArray.Create;
for vIndex := 0 to fEnum.Count - 1 do
begin
vJsonEnum.Add(fEnum[vIndex]);
end;
vJsonObject.AddPair(c_SwagRequestParameterEnum, vJsonEnum);
end;
Result := vJsonObject;
end;
procedure TSwagRequestParameter.Load(pJson: TJSONObject);
var
vEnum: TJSONArray;
i: Integer;
begin
if Assigned(pJson.Values[c_SwagRequestParameterRef]) then
begin
fRef := pJson.Values[c_SwagRequestParameterRef].Value;
Exit;
end;
if Assigned(pJson.Values[c_SwagRequestParameterIn]) then
fInLocation.ToType(pJson.Values[c_SwagRequestParameterIn].Value);
if Assigned(pJson.Values[c_SwagRequestParameterAllowEmptyValue]) and
((fInLocation = rpiQuery) or (fInLocation = rpiFormData)) then
fAllowEmptyValue := (pJson.Values[c_SwagRequestParameterAllowEmptyValue] as TJSONBool).AsBoolean;
if Assigned(pJson.Values[c_SwagRequestParameterRequired]) then
fRequired := (pJson.Values[c_SwagRequestParameterRequired] as TJSONBool).AsBoolean
else
fRequired := False;
if Assigned(pJson.Values[c_SwagRequestParameterPattern]) then
fPattern := pJson.Values[c_SwagRequestParameterPattern].Value;
if Assigned(pJson.Values[c_SwagRequestParameterName]) then
fName := pJson.Values[c_SwagRequestParameterName].Value;
if Assigned(pJson.Values[c_SwagRequestParameterDescription]) then
fDescription := pJson.Values[c_SwagRequestParameterDescription].Value;
if Assigned(pJson.Values[c_SwagRequestParameterFormat]) then
fFormat := pJson.Values[c_SwagRequestParameterFormat].Value;
if Assigned(pJson.Values[c_SwagRequestParameterType]) then
fTypeParameter.ToType(pJson.Values[c_SwagRequestParameterType].Value);
if Assigned(pJson.Values[c_SwagRequestParameterDefault]) then
fDefault := pJson.Values[c_SwagRequestParameterDefault].Value;
if Assigned(pJson.Values[c_SwagRequestParameterSchema]) then
fSchema.JsonSchema := pJson.Values[c_SwagRequestParameterSchema].Clone as TJSONObject;
if Assigned(pJson.Values['items']) then
fItems := pJson.Values['items'] as TJSONObject;
if Assigned(pJson.Values[c_SwagRequestParameterEnum]) then
begin
vEnum := pJson.Values[c_SwagRequestParameterEnum] as TJSONArray;
for i := 0 to vEnum.Count - 1 do
begin
fEnum.Add(vEnum.Items[i].Value);
end;
end;
end;
function TSwagRequestParameter.ReturnInLocationToString: string;
begin
Result := c_SwagRequestParameterInLocation[fInLocation];
end;
procedure TSwagRequestParameter.SetAllowEmptyValue(const pValue: Boolean);
begin
if (fInLocation = rpiQuery) or (fInLocation = rpiFormData) then
fAllowEmptyValue := pValue
else
raise Exception.Create('allowEmptyValue not allowed to be set on ' + ReturnInLocationToString);
end;
end.

View File

@ -1,192 +0,0 @@
{******************************************************************************}
{ }
{ Delphi SwagDoc Library }
{ Copyright (c) 2018 Marcelo Jaloto }
{ https://github.com/marcelojaloto/SwagDoc }
{ }
{******************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{******************************************************************************}
unit Swag.Doc.Path.Operation.Response;
interface
uses
System.Generics.Collections,
System.JSON,
Swag.Common.Types,
Swag.Doc.Path.Operation.ResponseHeaders,
Swag.Doc.Definition;
type
/// <summary>
/// Describes a single response from an API Operation.
/// A container for the expected responses of an operation.
/// The container maps a HTTP response code to the expected response.
/// It is not expected from the documentation to necessarily cover all possible HTTP response codes, since they may not be
/// known in advance. However, it is expected from the documentation to cover a successful operation response and any known errors.
/// The default can be used as the default response object for all HTTP codes that are not covered individually by the specification.
/// The Responses Object MUST contain at least one response code, and it SHOULD be the response for a successful operation call.
/// </summary>
TSwagResponse = class(TObject)
private
fStatusCode: TSwagStatusCode;
fSchema: TSwagDefinition;
fHeaders: TObjectList<TSwagHeaders>;
fDescription: string;
fExamples: TObjectDictionary<TSwagJsonExampleDescription, TJSONObject>;
protected
function GenerateExamplesJsonObject: TJSONObject;
public
constructor Create; reintroduce;
destructor Destroy; override;
function GenerateJsonObject: TJSONObject;
procedure Load(pJson : TJSONObject);
/// <summary>
/// Any HTTP status code can be used as the property name (one property per HTTP status code).
/// Describes the expected response for that HTTP status code.
/// Reference Object can be used to link to a response that is defined at the Swagger Object's responses section.
/// </summary>
property StatusCode: TSwagStatusCode read fStatusCode write fStatusCode;
/// <summary>
/// Required. A short description of the response. GFM syntax can be used for rich text representation.
/// </summary>
property Description: string read fDescription write fDescription;
/// <summary>
/// A definition of the response structure.
/// It can be a primitive, an array or an object.
/// If this field does not exist, it means no content is returned as part of the response.
/// As an extension to the Schema Object, its root type value may also be "file".
/// This SHOULD be accompanied by a relevant produces mime-type.
/// </summary>
property Schema: TSwagDefinition read fSchema;
/// <summary>
/// A list of headers that are sent with the response.
/// </summary>
property Headers : TObjectList<TSwagHeaders> read fHeaders;
/// <summary>
/// An example list of the json response message.
/// </summary>
property Examples: TObjectDictionary<TSwagJsonExampleDescription, TJSONObject> read fExamples;
end;
implementation
uses
System.SysUtils;
const
c_SwagResponseDescription = 'description';
c_SwagResponseSchema = 'schema';
c_SwagResponseExamples = 'examples';
c_SwagResponseHeaders = 'headers';
{ TSwagResponse }
constructor TSwagResponse.Create;
begin
inherited Create;
fExamples := TObjectDictionary<TSwagJsonExampleDescription, TJSONObject>.Create([doOwnsValues]);
fSchema := TSwagDefinition.Create;
fHeaders := TObjectList<TSwagHeaders>.Create;
end;
destructor TSwagResponse.Destroy;
begin
FreeAndNil(fExamples);
FreeAndNil(fSchema);
FreeAndNil(fHeaders);
inherited Destroy;
end;
function TSwagResponse.GenerateExamplesJsonObject: TJSONObject;
var
vKey: TSwagJsonExampleDescription;
vExampleNumber: Integer;
begin
Result := TJsonObject.Create;
vExampleNumber := 0;
for vKey in fExamples.Keys do
begin
Inc(vExampleNumber);
Result.AddPair(vExampleNumber.ToString, TJsonObject(fExamples.Items[vKey].Clone));
end;
end;
function TSwagResponse.GenerateJsonObject: TJSONObject;
var
vJsonObject: TJsonObject;
vIndex: Integer;
vJsonHeaders: TJSONObject;
begin
vJsonObject := TJsonObject.Create;
vJsonObject.AddPair(c_SwagResponseDescription, fDescription);
if (not fSchema.Name.IsEmpty) then
vJsonObject.AddPair(c_SwagResponseSchema, fSchema.GenerateJsonRefDefinition)
else if Assigned(fSchema.JsonSchema) then
vJsonObject.AddPair(c_SwagResponseSchema, fSchema.JsonSchema.Clone as TJSONObject);
if (fExamples.Count > 0) then
vJsonObject.AddPair(c_SwagResponseExamples, GenerateExamplesJsonObject);
if fHeaders.Count > 0 then
begin
vJsonHeaders := TJSONObject.Create;
for vIndex := 0 to fHeaders.Count - 1 do
begin
vJsonHeaders.AddPair(fHeaders[vIndex].Name, fHeaders[vIndex].GenerateJsonObject);
end;
vJsonObject.AddPair(c_SwagResponseHeaders, vJsonHeaders);
end;
Result := vJsonObject;
end;
procedure TSwagResponse.Load(pJson: TJSONObject);
var
vJSONHeaders: TJSONObject;
vIndex: Integer;
vHeader: TSwagHeaders;
begin
if not Assigned(pJson) then
Exit;
if Assigned(pJson.Values[c_SwagResponseDescription]) then
fDescription := pJson.Values[c_SwagResponseDescription].Value;
if Assigned(pJson.Values[c_SwagResponseHeaders]) then
begin
vJSONHeaders := pJson.Values[c_SwagResponseHeaders] as TJSONObject;
for vIndex := 0 to vJSONHeaders.Count - 1 do
begin
vHeader := TSwagHeaders.Create;
vHeader.Load(vJSONHeaders.Pairs[vIndex].JsonValue as TJSONObject);
vHeader.Name := vJSONHeaders.Pairs[vIndex].JsonString.Value;
fHeaders.Add(vheader);
end;
end;
if Assigned(pJson.Values[c_SwagResponseSchema]) then
fSchema.JsonSchema := pJson.Values[c_SwagResponseSchema].Clone as TJSONObject;
end;
end.

View File

@ -1,96 +0,0 @@
{******************************************************************************}
{ }
{ Delphi SwagDoc Library }
{ Copyright (c) 2018 Marcelo Jaloto }
{ https://github.com/marcelojaloto/SwagDoc }
{ }
{******************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{******************************************************************************}
unit Swag.Doc.Path.Operation.ResponseHeaders;
interface
uses
System.SysUtils,
System.Json;
type
/// <summary>
/// Lists the headers that can be sent as part of a response.
/// </summary>
TSwagHeaders = class(TObject)
private
fName: string;
fDescription: string;
fType: string;
fFormat: string;
public
function GenerateJsonObject: TJSONObject;
procedure Load(pJson : TJSONObject);
/// <summary>
/// A header name alias.
/// </summary>
property Name: string read fName write fName;
/// <summary>
/// A short description of the header.
/// </summary>
property Description: string read fDescription write fDescription;
/// <summary>
/// Required. The type of the object. The value MUST be one of "string", "number", "integer", "boolean", or "array".
/// </summary>
property ValueType: string read fType write fType;
property Format: string read fFormat write fFormat;
end;
implementation
const
c_SwagHeadersDescription = 'description';
c_SwagHeadersType = 'type';
c_SwagHeadersFormat = 'format';
{ TSwagHeaders }
function TSwagHeaders.GenerateJsonObject: TJSONObject;
var
vJsonObject: TJsonObject;
begin
vJsonObject := TJSONObject.Create;
if fDescription.Length > 0 then
vJsonObject.AddPair(c_SwagHeadersDescription, fDescription);
if fType.Length > 0 then
vJsonObject.AddPair(c_SwagHeadersType, fType);
if fFormat.Length > 0 then
vJsonObject.AddPair(c_SwagHeadersFormat, fFormat);
Result := vJsonObject;
end;
procedure TSwagHeaders.Load(pJson: TJSONObject);
begin
if Assigned(pJson.Values[c_SwagHeadersDescription]) then
fDescription := pJson.Values[c_SwagHeadersDescription].Value;
if Assigned(pJson.Values[c_SwagHeadersType]) then
fType := pJson.Values[c_SwagHeadersType].Value;
if Assigned(pJson.Values[c_SwagHeadersFormat]) then
fFormat := pJson.Values[c_SwagHeadersFormat].Value;
end;
end.

View File

@ -1,275 +0,0 @@
{******************************************************************************}
{ }
{ Delphi SwagDoc Library }
{ Copyright (c) 2018 Marcelo Jaloto }
{ https://github.com/marcelojaloto/SwagDoc }
{ }
{******************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{******************************************************************************}
unit Swag.Doc.Path.Operation;
interface
uses
System.Generics.Collections,
System.JSON,
Swag.Common.Types,
Swag.Doc.Path.Operation.Response,
Swag.Doc.Tags,
Swag.Doc.Path.Operation.RequestParameter;
type
/// <summary>
/// Describes a single API operation on a path.
/// </summary>
TSwagPathOperation = class(TObject)
private
fOperation: TSwagPathTypeOperation;
fDescription: string;
fConsumes: TList<TSwagMimeType>;
fProduces: TList<TSwagMimeType>;
fParameters: TObjectList<TSwagRequestParameter>;
fResponses: TObjectDictionary<TSwagStatusCode, TSwagResponse>;
fSecurity: TList<TSwagSecuritySchemeName>;
fTags: TList<string>;
fExternalDocs: TSwagExternalDocs;
fOperationId: string;
fDeprecated: Boolean;
fSummary: string;
function GetOperationToString: string;
protected
function GenerateTagsJsonArray(pTagList: TList<string>): TJSONArray;
function GenerateMimeTypesJsonArray(pMimeTypesList: TList<TSwagMimeType>): TJSONArray;
function GenerateParametersJsonArray: TJSONArray;
function GenarateResponsesJsonObject: TJSONObject;
function GenerateSecurityJsonArray: TJSONArray;
public
constructor Create; reintroduce;
destructor Destroy; override;
function GenerateJsonObject: TJSONObject;
property Operation: TSwagPathTypeOperation read fOperation write fOperation;
property OperationToString: string read GetOperationToString;
property OperationId : string read fOperationId write fOperationId;
property Summary: string read fSummary write fSummary;
/// <summary>
/// A list of tags for API documentation control.
/// Tags can be used for logical grouping of operations by resources or any other qualifier.
/// </summary>
property Tags: TList<string> read fTags;
/// <summary>
/// A verbose explanation of the operation behavior. GFM syntax can be used for rich text representation.
/// </summary>
property Description: string read fDescription write fDescription;
/// <summary>
/// A list of MIME types the operation can consume. This overrides the consumes definition at the Swagger Object.
/// An empty value MAY be used to clear the global definition. Value MUST be as described under Mime Types.
/// </summary>
property Consumes: TList<TSwagMimeType> read fConsumes;
/// <summary>
/// A list of MIME types the operation can produce. This overrides the produces definition at the Swagger Object.
/// An empty value MAY be used to clear the global definition. Value MUST be as described under Mime Types.
/// </summary>
property Produces: TList<TSwagMimeType> read fProduces;
/// <summary>
/// A list of parameters that are applicable for this operation.
/// If a parameter is already defined at the Path Item, the new definition will override it, but can never remove it.
/// The list MUST NOT include duplicated parameters.
/// A unique parameter is defined by a combination of a name and location.
/// The list can use the Reference Object to link to parameters that are defined at the Swagger Object's parameters.
/// There can be one "body" parameter at most.
/// </summary>
property Parameters: TObjectList<TSwagRequestParameter> read fParameters;
/// <summary>
/// Required. The list of possible responses as they are returned from executing this operation.
/// </summary>
property Responses: TObjectDictionary<TSwagStatusCode, TSwagResponse> read fResponses;
/// <summary>
/// Declares this operation to be deprecated. Usage of the declared operation should be refrained.
/// Default value is false.
/// </summary>
property Deprecated: Boolean read fDeprecated write fDeprecated;
/// <summary>
/// Lists the required security schemes to execute this operation.
/// The object can have multiple security schemes declared in it which are all required (that is, there is a logical
/// AND between the schemes).
/// The name used for each property MUST correspond to a security scheme declared in the Security Definitions.
/// A declaration of which security schemes are applied for this operation.
/// The list of values describes alternative security schemes that can be used (that is, there is a logical
/// OR between the security requirements). This definition overrides any declared top-level security.
/// To remove a top-level security declaration, an empty array can be used.
/// </summary>
property Security: TList<TSwagSecuritySchemeName> read fSecurity;
property ExternalDocs: TSwagExternalDocs read fExternalDocs;
end;
implementation
uses
System.SysUtils,
Swag.Doc.Path,
Swag.Common.Consts;
const
c_SwagPathOperationDescription = 'description';
c_SwagPathOperationTags = 'tags';
c_SwagPathOperationOperationId = 'operationId';
c_SwagPathOperationDeprecated = 'deprecated';
c_SwagPathOperationProduces = 'produces';
c_SwagPathOperationConsumes = 'consumes';
c_SwagPathOperationParameters = 'parameters';
c_SwagPathOperationResponses = 'responses';
c_SwagPathOperationSecurity = 'security';
c_SwagPathOperationSummary = 'summary';
c_SwagPathOperationExternalDocs = 'externalDocs';
{ TSwagPathOperation }
constructor TSwagPathOperation.Create;
begin
inherited Create;
fTags := TList<string>.Create;
fConsumes := TList<TSwagMimeType>.Create;
fProduces := TList<TSwagMimeType>.Create;
fParameters := TObjectList<TSwagRequestParameter>.Create;
fResponses := TObjectDictionary<TSwagStatusCode, TSwagResponse>.Create([doOwnsValues]);
fSecurity := TList<TSwagSecuritySchemeName>.Create;
fExternalDocs := TSwagExternalDocs.Create;
end;
destructor TSwagPathOperation.Destroy;
begin
FreeAndNil(fProduces);
FreeAndNil(fConsumes);
FreeAndNil(fResponses);
FreeAndNil(fParameters);
FreeAndNil(fSecurity);
FreeAndNil(fTags);
FreeAndNil(fExternalDocs);
inherited Destroy;
end;
function TSwagPathOperation.GetOperationToString: string;
begin
Result := c_SwagPathOperationHttpVerbs[fOperation];
end;
function TSwagPathOperation.GenarateResponsesJsonObject: TJSONObject;
var
vResponse: TSwagResponse;
vResponsesSortedArray: TArray<TSwagStatusCode>;
vStatusCode: TSwagStatusCode;
begin
Result := TJsonObject.Create;
vResponsesSortedArray := fResponses.Keys.ToArray;
TArray.Sort<TSwagStatusCode>(vResponsesSortedArray);
for vStatusCode in vResponsesSortedArray do
begin
vResponse := fResponses.Items[vStatusCode];
Result.AddPair(vResponse.StatusCode, vResponse.GenerateJsonObject);
end;
end;
function TSwagPathOperation.GenerateMimeTypesJsonArray(pMimeTypesList: TList<TSwagMimeType>): TJSONArray;
var
vIndex: Integer;
begin
Result := TJSONArray.Create;
for vIndex := 0 to pMimeTypesList.Count -1 do
Result.Add(pMimeTypesList.Items[vIndex]);
end;
function TSwagPathOperation.GenerateParametersJsonArray: TJSONArray;
var
vIndex: Integer;
begin
Result := TJSONArray.Create;
for vIndex := 0 to fParameters.Count - 1 do
Result.Add(fParameters.Items[vIndex].GenerateJsonObject);
end;
// suports only JWT in swagger version 2.0
function TSwagPathOperation.GenerateSecurityJsonArray: TJSONArray;
var
vIndex: Integer;
vJsonItem: TJsonObject;
vJsonListSecurityScopes: TJSONArray;
begin
Result := TJSONArray.Create;
for vIndex := 0 to fSecurity.Count - 1 do
begin
vJsonListSecurityScopes := TJSONArray.Create;
vJsonItem := TJsonObject.Create;
vJsonItem.AddPair(fSecurity.Items[vIndex], vJsonListSecurityScopes);
Result.Add(vJsonItem);
end;
end;
function TSwagPathOperation.GenerateTagsJsonArray(pTagList: TList<string>): TJSONArray;
var
vIndex: Integer;
begin
Result := TJSONArray.Create;
for vIndex := 0 to pTagList.Count -1 do
Result.Add(pTagList.Items[vIndex]);
end;
function TSwagPathOperation.GenerateJsonObject: TJSONObject;
var
vJsonObject: TJsonObject;
begin
vJsonObject := TJsonObject.Create;
if (fTags.Count > 0) then
vJsonObject.AddPair(c_SwagPathOperationTags, GenerateTagsJsonArray(fTags));
if fSummary.Length > 0 then
vJsonObject.AddPair(c_SwagPathOperationSummary, fSummary);
if fDescription.Length > 0 then
vJsonObject.AddPair(c_SwagPathOperationDescription, fDescription);
if (not fExternalDocs.url.IsEmpty) or (not fExternalDocs.description.IsEmpty) then
vJsonObject.AddPair(c_SwagPathOperationExternalDocs, fExternalDocs.GenerateJsonObject);
if fDeprecated then
vJsonObject.AddPair(c_SwagPathOperationDeprecated, TJSONBool.Create(fDeprecated));
if not fOperationId.IsEmpty then
vJsonObject.AddPair(c_SwagPathOperationOperationId, fOperationId);
if (fConsumes.Count > 0) then
vJsonObject.AddPair(c_SwagPathOperationConsumes, GenerateMimeTypesJsonArray(fConsumes));
if (fProduces.Count > 0) then
vJsonObject.AddPair(c_SwagPathOperationProduces, GenerateMimeTypesJsonArray(fProduces));
if (fParameters.Count > 0) then
vJsonObject.AddPair(c_SwagPathOperationParameters, GenerateParametersJsonArray);
if (fResponses.Count > 0) then
vJsonObject.AddPair(c_SwagPathOperationResponses, GenarateResponsesJsonObject);
if (fSecurity.Count > 0) then
vJsonObject.AddPair(c_SwagPathOperationSecurity, GenerateSecurityJsonArray);
Result := vJsonObject;
end;
end.

View File

@ -1,278 +0,0 @@
{******************************************************************************}
{ }
{ Delphi SwagDoc Library }
{ Copyright (c) 2018 Marcelo Jaloto }
{ https://github.com/marcelojaloto/SwagDoc }
{ }
{******************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{******************************************************************************}
unit Swag.Doc.Path;
interface
uses
System.Classes,
System.Generics.Collections,
System.RegularExpressions,
System.JSON,
Swag.Common.Types,
Swag.Doc.Path.Operation.RequestParameter,
Swag.Doc.Path.Operation.Response,
Swag.Doc.Path.Operation;
type
/// <summary>
/// Holds the relative paths to the individual endpoints.
/// The path is appended to the basePath in order to construct the full URL.
/// The Paths may be empty, due to ACL constraints.
/// </summary>
TSwagPath = class(TObject)
private
fOperations: TObjectList<TSwagPathOperation>;
fUri: string;
fParameters: TObjectList<TSwagRequestParameter>;
procedure LoadResponse(pOperation: TSwagPathOperation; pJsonResponse: TJSONObject);
procedure LoadOperationScopedParameters(pOperation: TSwagPathOperation; pJsonRequestParams: TJSONArray);
procedure LoadPathScopedParameters(pJsonRequestParams: TJSONArray);
procedure LoadTags(pOperation: TSwagPathOperation; pJsonTags: TJSONArray);
procedure LoadProduces(pOperation: TSwagPathOperation; pJsonProduces: TJSONArray);
procedure LoadConsumes(pOperation: TSwagPathOperation; pJsonConsumes: TJSONArray);
function GenerateParametersJsonObject: TJSONArray;
public
constructor Create; reintroduce;
destructor Destroy; override;
function GenerateJsonObject: TJSONObject;
procedure Load(pJson: TJSONObject);
/// <summary>
/// A relative path to an individual endpoint. The field name MUST begin with a slash.
/// The path is appended to the basePath in order to construct the full URL. Path templating is allowed.
/// </summary>
property Uri: string read fUri write fUri;
/// <summary>
/// Describes a single API operation on a path.
/// </summary>
property Operations: TObjectList<TSwagPathOperation> read fOperations;
property Parameters: TObjectList<TSwagRequestParameter> read fParameters;
end;
implementation
uses
System.SysUtils,
Swag.Common.Types.Helpers;
{ TSwagPath }
constructor TSwagPath.Create;
begin
inherited Create;
fOperations := TObjectList<TSwagPathOperation>.Create;
fParameters := TObjectList<TSwagRequestParameter>.Create;
end;
destructor TSwagPath.Destroy;
begin
FreeAndNil(fOperations);
FreeAndNil(fParameters);
inherited Destroy;
end;
function TSwagPath.GenerateParametersJsonObject: TJSONArray;
var
vIndex: Integer;
begin
Result := TJSONArray.Create;
for vIndex := 0 to fParameters.Count - 1 do
begin
Result.Add(fParameters[vIndex].GenerateJsonObject);
end;
end;
function TSwagPath.GenerateJsonObject: TJSONObject;
var
vIndex: integer;
begin
Result := TJsonObject.Create;
if fParameters.Count > 0 then
Result.AddPair('parameters', GenerateParametersJsonObject);
for vIndex := 0 to fOperations.Count -1 do
Result.AddPair(fOperations.Items[vIndex].OperationToString, fOperations.Items[vIndex].GenerateJsonObject);
end;
procedure TSwagPath.Load(pJson: TJSONObject);
var
vIndex: Integer;
vOperation: TSwagPathOperation;
vOperationJson: TJSONObject;
vOperationExternalDocs: TJSONObject;
vOperationName: string;
begin
if not Assigned(pJson) then
Exit;
for vIndex := 0 to pJson.Count - 1 do
begin
vOperation := TSwagPathOperation.Create;
vOperationName := pJson.Pairs[vIndex].JsonString.Value;
if vOperationName = 'parameters' then
begin
LoadPathScopedParameters(pJson.Pairs[vIndex].JsonValue as TJSONArray);
continue;
end;
if TRegEx.IsMatch(vOperationName, '(^x-)') then
begin
// This is an extension value - ignore
continue;
end;
if not (pJson.Pairs[vIndex].JsonValue is TJSONObject) then
begin
// This shouldn't happen - although it may be valid in openapi documents
continue;
end;
vOperationJson := pJson.Pairs[vIndex].JsonValue as TJSONObject;
if Assigned(vOperationJson.Values['description']) then
vOperation.Description := vOperationJson.Values['description'].Value;
if Assigned(vOperationJson.Values['summary']) then
vOperation.Summary := vOperationJson.Values['summary'].Value;
vOperationExternalDocs := vOperationJson.Values['externalDocs'] as TJSONObject;
if Assigned(vOperationExternalDocs) then
begin
if Assigned(vOperationExternalDocs.Values['url']) then
vOperation.ExternalDocs.Url := vOperationExternalDocs.Values['url'].Value;
if Assigned(vOperationExternalDocs.Values['description'])then
vOperation.ExternalDocs.Description := vOperationExternalDocs.Values['description'].Value;
end;
vOperation.Operation.ToType(pJson.Pairs[vIndex].JsonString.Value);
if Assigned(vOperationJson.Values['operationId']) then
vOperation.OperationId := vOperationJson.Values['operationId'].Value;
if Assigned(vOperationJson.Values['deprecated']) then
vOperation.Deprecated := (vOperationJson.Values['deprecated'] as TJSONBool).AsBoolean;
LoadTags(vOperation, vOperationJson.Values['tags'] as TJSONArray);
LoadProduces(vOperation, vOperationJson.Values['produces'] as TJSONArray);
LoadConsumes(vOperation, vOperationJson.Values['consumes'] as TJSONArray);
LoadOperationScopedParameters(vOperation, vOperationJson.Values['parameters'] as TJSONArray);
LoadResponse(vOperation, vOperationJson.Values['responses'] as TJSONObject);
fOperations.Add(vOperation);
end;
end;
procedure TSwagPath.LoadTags(pOperation: TSwagPathOperation; pJsonTags: TJSONArray);
var
vIndex: Integer;
vTag: string;
begin
if not Assigned(pJsonTags) then
Exit;
for vIndex := 0 to pJsonTags.Count - 1 do
begin
vTag := pJsonTags.Items[vIndex].Value;
pOperation.Tags.Add(vTag);
end;
end;
procedure TSwagPath.LoadPathScopedParameters(pJsonRequestParams: TJSONArray);
var
vIndex: Integer;
vRequestParam: TSwagRequestParameter;
begin
if not Assigned(pJsonRequestParams) then
Exit;
for vIndex := 0 to pJsonRequestParams.Count - 1 do
begin
vRequestParam := TSwagRequestParameter.Create;
vRequestParam.Load(pJsonRequestParams.Items[vIndex] as TJSONObject);
Parameters.Add(vRequestParam);
end;
end;
procedure TSwagPath.LoadOperationScopedParameters(pOperation: TSwagPathOperation; pJsonRequestParams: TJSONArray);
var
vIndex: Integer;
vRequestParam: TSwagRequestParameter;
begin
if not Assigned(pJsonRequestParams) then
Exit;
for vIndex := 0 to pJsonRequestParams.Count - 1 do
begin
vRequestParam := TSwagRequestParameter.Create;
vRequestParam.Load(pJsonRequestParams.Items[vIndex] as TJSONObject);
pOperation.Parameters.Add(vRequestParam);
end;
end;
procedure TSwagPath.LoadProduces(pOperation: TSwagPathOperation; pJsonProduces: TJSONArray);
var
vIndex: Integer;
vProduces: string;
begin
if not Assigned(pJsonProduces) then
Exit;
for vIndex := 0 to pJsonProduces.Count - 1 do
begin
vProduces := pJsonProduces.Items[vIndex].Value;
pOperation.Produces.Add(vProduces);
end;
end;
procedure TSwagPath.LoadConsumes(pOperation: TSwagPathOperation; pJsonConsumes: TJSONArray);
var
vIndex: Integer;
vConsumes: string;
begin
if not Assigned(pJsonConsumes) then
Exit;
for vIndex := 0 to pJsonConsumes.Count - 1 do
begin
vConsumes := pJsonConsumes.Items[vIndex].Value;
pOperation.Consumes.Add(vConsumes);
end;
end;
procedure TSwagPath.LoadResponse(pOperation: TSwagPathOperation; pJsonResponse: TJSONObject);
var
vIndex: Integer;
vResponse: TSwagResponse;
begin
if not Assigned(pJsonResponse) then
Exit;
for vIndex := 0 to pJsonResponse.Count - 1 do
begin
vResponse := TSwagResponse.Create;
vResponse.StatusCode := pJsonResponse.Pairs[vIndex].JsonString.Value;
vResponse.Load(pJsonResponse.Pairs[vIndex].JsonValue as TJSONObject);
pOperation.Responses.Add(vResponse.StatusCode, vResponse);
end;
end;
end.

View File

@ -1,162 +0,0 @@
{******************************************************************************}
{ }
{ Delphi SwagDoc Library }
{ Copyright (c) 2018 Marcelo Jaloto }
{ https://github.com/marcelojaloto/SwagDoc }
{ }
{******************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{******************************************************************************}
unit Swag.Doc.SecurityDefinition;
interface
uses
System.Classes,
System.JSON,
System.SysUtils,
System.Generics.Collections,
Swag.Common.Types;
type
TSwagSecurityDefinitionClass = class of TSwagSecurityDefinition;
TSwagGetClassSecurityDefinition = class(TObject)
strict private
fClassFound: TPersistentClass;
fSecurityType: TSwagSecurityDefinitionType;
fSecurityTypes: TDictionary<TSwagSecurityDefinitionType, TSwagSecurityDefinitionClass>;
procedure DoGettingSecurityDefinitionClass(pClass: TPersistentClass);
procedure GetClasses;
public
constructor Create(const pSecurityType: TSwagSecurityDefinitionType);
destructor Destroy; override;
class function Find(const pSecurityType: TSwagSecurityDefinitionType): TPersistentClass;
property ClassFound: TPersistentClass read fClassFound;
end;
/// <summary>
/// A declaration of the security schemes available to be used in the specification.
/// This does not enforce the security schemes on the operations and only serves to provide the relevant details for each scheme.
/// </summary>
TSwagSecurityDefinition = class abstract(TPersistent)
protected
fSchemaName: TSwagSecuritySchemeName;
fDescription: string;
function GetTypeSecurity: TSwagSecurityDefinitionType; virtual; abstract;
function ReturnTypeSecurityToString: string; virtual;
public
constructor Create; virtual;
function GenerateJsonObject: TJSONObject; virtual; abstract;
procedure Load(pJson: TJSONObject); virtual; abstract;
/// <summary>
/// A single security scheme definition, mapping a "name" to the scheme it defines.
/// </summary>
property SchemeName: TSwagSecuritySchemeName read fSchemaName write fSchemaName;
/// <summary>
/// Required. The type of the security scheme. Valid values are "basic", "apiKey" or "oauth2".
/// </summary>
property TypeSecurity: TSwagSecurityDefinitionType read GetTypeSecurity;
/// <summary>
/// A short description for security scheme.
/// </summary>
property Description: string read fDescription write fDescription;
end;
implementation
uses
System.Rtti,
Swag.Common.Consts,
Swag.Common.Types.Helpers;
{ TSwagGetClassSecurityDefinition }
constructor TSwagGetClassSecurityDefinition.Create(const pSecurityType: TSwagSecurityDefinitionType);
begin
inherited Create;
fSecurityType := pSecurityType;
fSecurityTypes := TDictionary<TSwagSecurityDefinitionType, TSwagSecurityDefinitionClass>.Create;
end;
destructor TSwagGetClassSecurityDefinition.Destroy;
begin
fSecurityTypes.Free;
inherited Destroy;
end;
procedure TSwagGetClassSecurityDefinition.DoGettingSecurityDefinitionClass(pClass: TPersistentClass);
var
vContext: TRttiContext;
vType: TRttiType;
vAttribute: TCustomAttribute;
begin
vContext := TRttiContext.Create;
vType := vContext.GetType(pClass);
for vAttribute in vType.GetAttributes do
if (vAttribute is ASecurityDefinition) and
(fSecurityType = ASecurityDefinition(vAttribute).Definition) then
begin
fClassFound := pClass;
Break;
end;
end;
class function TSwagGetClassSecurityDefinition.Find(const pSecurityType: TSwagSecurityDefinitionType): TPersistentClass;
var
vGetClass: TSwagGetClassSecurityDefinition;
begin
vGetClass := TSwagGetClassSecurityDefinition.Create(pSecurityType);
try
vGetClass.GetClasses;
Result := vGetClass.ClassFound;
finally
vGetClass.Free;
end;
end;
procedure TSwagGetClassSecurityDefinition.GetClasses;
var
vClassFinder: TClassFinder;
begin
vClassFinder := TClassFinder.Create(TSwagSecurityDefinition, False);
try
vClassFinder.GetClasses(DoGettingSecurityDefinitionClass);
finally
vClassFinder.Free;
end;
end;
{ TSwagSecurityDefinition }
constructor TSwagSecurityDefinition.Create;
begin
inherited Create;
end;
function TSwagSecurityDefinition.ReturnTypeSecurityToString: string;
begin
Result := c_SwagSecurityDefinitionType[GetTypeSecurity];
end;
end.

View File

@ -1,119 +0,0 @@
{******************************************************************************}
{ }
{ Delphi SwagDoc Library }
{ Copyright (c) 2018 Marcelo Jaloto }
{ https://github.com/marcelojaloto/SwagDoc }
{ }
{******************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{******************************************************************************}
unit Swag.Doc.SecurityDefinitionApiKey;
interface
uses
System.SysUtils,
System.JSON,
Swag.Common.Types,
Swag.Doc.SecurityDefinition;
type
TSwagSecurityDefinitionApiKeyInLocation = (kilNotDefined, kilQuery, kilHeader);
type
/// <summary>
/// The security scheme object API key (either as a header or as a query parameter)
/// </summary>
[ASecurityDefinition(ssdApiKey)]
TSwagSecurityDefinitionApiKey = class(TSwagSecurityDefinition)
private
fName: string;
fInLocation: TSwagSecurityDefinitionApiKeyInLocation;
protected
function GetTypeSecurity: TSwagSecurityDefinitionType; override;
public
function GenerateJsonObject: TJSONObject; override;
procedure Load(pJson: TJSONObject); override;
/// <summary>
/// Required The location of the API key. Valid values are "query" or "header".
/// </summary>
property InLocation: TSwagSecurityDefinitionApiKeyInLocation read fInLocation write fInLocation;
/// <summary>
/// Required. The name of the header or query parameter to be used.
/// </summary>
property Name: string read fName write fName;
end;
implementation
uses
System.Classes;
const
c_SwagSecurityDefinitionApiKeyType = 'type';
c_SwagSecurityDefinitionApiKeyDescription = 'description';
c_SwagSecurityDefinitionApiKeyIn = 'in';
c_SwagSecurityDefinitionApiKeyName = 'name';
c_SwagSecurityDefinitionApiKeyInLocation: array[TSwagSecurityDefinitionApiKeyInLocation] of string =
('', 'query', 'header');
{ TSwagSecurityDefinitionApiKey }
function TSwagSecurityDefinitionApiKey.GenerateJsonObject: TJSONObject;
var
vJsonItem: TJsonObject;
begin
vJsonItem := TJsonObject.Create;
vJsonItem.AddPair(c_SwagSecurityDefinitionApiKeyType, ReturnTypeSecurityToString);
if fDescription.Length > 0 then
vJsonItem.AddPair(c_SwagSecurityDefinitionApiKeyDescription, fDescription);
vJsonItem.AddPair(c_SwagSecurityDefinitionApiKeyIn, c_SwagSecurityDefinitionApiKeyInLocation[fInLocation]);
vJsonItem.AddPair(c_SwagSecurityDefinitionApiKeyName, fName);
Result := vJsonItem;
end;
function TSwagSecurityDefinitionApiKey.GetTypeSecurity: TSwagSecurityDefinitionType;
begin
Result := ssdApiKey;
end;
procedure TSwagSecurityDefinitionApiKey.Load(pJson: TJSONObject);
var
vIn: string;
begin
if Assigned(pJson.Values[c_SwagSecurityDefinitionApiKeyDescription]) then
fDescription := pJson.Values[c_SwagSecurityDefinitionApiKeyDescription].Value;
if Assigned(pJson.Values[c_SwagSecurityDefinitionApiKeyName]) then
fName := pJson.Values[c_SwagSecurityDefinitionApiKeyName].Value;
if Assigned(pJson.Values[c_SwagSecurityDefinitionApiKeyIn]) then
begin
vIn := pJson.Values[c_SwagSecurityDefinitionApiKeyIn].Value;
if vIn.ToLower = c_SwagSecurityDefinitionApiKeyInLocation[kilQuery] then
fInLocation := kilQuery
else if vIn.ToLower = c_SwagSecurityDefinitionApiKeyInLocation[kilHeader] then
fInLocation := kilHeader
else
fInLocation := kilNotDefined;
end;
end;
initialization
RegisterClass(TSwagSecurityDefinitionApiKey);
end.

View File

@ -1,84 +0,0 @@
{******************************************************************************}
{ }
{ Delphi SwagDoc Library }
{ Copyright (c) 2018 Marcelo Jaloto }
{ https://github.com/marcelojaloto/SwagDoc }
{ }
{******************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{******************************************************************************}
unit Swag.Doc.SecurityDefinitionBasic;
interface
uses
System.SysUtils,
System.JSON,
Swag.Common.Types,
Swag.Doc.SecurityDefinition;
type
/// <summary>
/// The security scheme object Basic
/// </summary>
[ASecurityDefinition(ssdBasic)]
TSwagSecurityDefinitionBasic = class(TSwagSecurityDefinition)
private
fName: string;
protected
function GetTypeSecurity: TSwagSecurityDefinitionType; override;
public
function GenerateJsonObject: TJSONObject; override;
procedure Load(pJson: TJSONObject); override;
property Name: string read fName write fName;
end;
implementation
uses
System.Classes;
const
c_SwagSecurityDefinitionBasicType = 'type';
c_SwagSecurityDefinitionBasicName = 'name';
{ TSwagSecurityDefinitionApiKey }
function TSwagSecurityDefinitionBasic.GenerateJsonObject: TJSONObject;
var
vJsonItem: TJsonObject;
begin
vJsonItem := TJsonObject.Create;
vJsonItem.AddPair(c_SwagSecurityDefinitionBasicType, ReturnTypeSecurityToString);
Result := vJsonItem;
end;
function TSwagSecurityDefinitionBasic.GetTypeSecurity: TSwagSecurityDefinitionType;
begin
Result := ssdBasic;
end;
procedure TSwagSecurityDefinitionBasic.Load(pJson: TJSONObject);
begin
if Assigned(pJson.Values[c_SwagSecurityDefinitionBasicName]) then
fName := pJson.Values[c_SwagSecurityDefinitionBasicName].Value;
end;
initialization
RegisterClass(TSwagSecurityDefinitionBasic);
end.

View File

@ -1,173 +0,0 @@
{******************************************************************************}
{ }
{ Delphi SwagDoc Library }
{ Copyright (c) 2018 Marcelo Jaloto }
{ https://github.com/marcelojaloto/SwagDoc }
{ }
{******************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{******************************************************************************}
unit Swag.Doc.SecurityDefinitionOAuth2;
interface
uses
System.JSON,
System.SysUtils,
System.Generics.Collections,
Swag.Common.Types,
Swag.Doc.SecurityDefinition;
type
TSwagSecurityDefinitionOAuth2Scope = class(TObject)
private
fScopeName: string;
fDescription: string;
public
function GenerateJsonObject: TJSONObject;
procedure Load(pJson: TJSONPair);
property ScopeName: string read fScopeName write fScopeName;
property Description: string read fDescription write fDescription;
end;
/// <summary>
/// The security scheme object for OAuth2
/// </summary>
[ASecurityDefinition(ssdOAuth2)]
TSwagSecurityDefinitionOAuth2 = class(TSwagSecurityDefinition)
private
fName: string;
fAuthorizationUrl: string;
fFlow: string;
fScopes : TObjectList<TSwagSecurityDefinitionOAuth2Scope>;
protected
function GetTypeSecurity: TSwagSecurityDefinitionType; override;
public
function GenerateJsonObject: TJSONObject; override;
procedure Load(pJson: TJSONObject); override;
property Name: string read fName write fName;
property AuthorizationUrl: string read fAuthorizationUrl write fAuthorizationUrl;
property Flow: string read fFlow write fFlow;
property Scopes: TObjectList<TSwagSecurityDefinitionOAuth2Scope> read fScopes;
constructor Create; override;
destructor Destroy; override;
end;
implementation
uses
Classes;
const
c_SwagSecurityDefinitionOAuth2Type = 'type';
c_SwagSecurityDefinitionOAuth2Description = 'description';
c_SwagSecurityDefinitionOAuth2Name = 'name';
c_SwagSecurityDefinitionOAuth2AuthorizationUrl = 'authorizationUrl';
c_SwagSecurityDefinitionOAuth2Flow = 'flow';
c_SwagSecurityDefinitionOAuth2Scopes = 'scopes';
{ TSwagSecurityDefinitionOAuth2Scopes }
function TSwagSecurityDefinitionOAuth2Scope.GenerateJsonObject: TJSONObject;
begin
Result := TJSONObject.Create;
Result.AddPair(fScopeName, fDescription);
end;
procedure TSwagSecurityDefinitionOAuth2Scope.Load(pJson: TJSONPair);
begin
fScopeName := pJson.JsonString.Value;
fDescription := pJson.JsonValue.Value;
end;
{ TSwagSecurityDefinitionOAuth2 }
constructor TSwagSecurityDefinitionOAuth2.Create;
begin
inherited;
fScopes := TObjectList<TSwagSecurityDefinitionOAuth2Scope>.Create;
end;
destructor TSwagSecurityDefinitionOAuth2.Destroy;
begin
FreeAndNil(fScopes);
inherited;
end;
function TSwagSecurityDefinitionOAuth2.GenerateJsonObject: TJSONObject;
var
vJsonItem: TJsonObject;
vJsonScopes: TJsonObject;
vScopeIndex: Integer;
begin
vJsonItem := TJsonObject.Create;
vJsonItem.AddPair(c_SwagSecurityDefinitionOAuth2Type, ReturnTypeSecurityToString);
if fDescription.Length > 0 then
vJsonItem.AddPair(c_SwagSecurityDefinitionOAuth2Description, fDescription);
vJsonItem.AddPair(c_SwagSecurityDefinitionOAuth2AuthorizationUrl, fAuthorizationUrl);
vJsonItem.AddPair(c_SwagSecurityDefinitionOAuth2Flow, fFlow);
if fScopes.Count > 0 then
begin
vJsonScopes := TJSONObject.Create;
for vScopeIndex := 0 to fScopes.Count - 1 do
begin
vJsonScopes.AddPair(FScopes[vScopeIndex].ScopeName, fScopes[vScopeIndex].fDescription);
end;
vJsonItem.AddPair(c_SwagSecurityDefinitionOAuth2Scopes, vJsonScopes);
end;
Result := vJsonItem;
end;
function TSwagSecurityDefinitionOAuth2.GetTypeSecurity: TSwagSecurityDefinitionType;
begin
Result := TSwagSecurityDefinitionType.ssdOAuth2;
end;
procedure TSwagSecurityDefinitionOAuth2.Load(pJson: TJSONObject);
var
vScopeIndex: Integer;
vJsonScope: TJSONObject;
vScope: TSwagSecurityDefinitionOAuth2Scope;
begin
inherited;
if Assigned(pJson.Values[c_SwagSecurityDefinitionOAuth2Description]) then
fDescription := pJson.Values[c_SwagSecurityDefinitionOAuth2Description].Value;
if Assigned(pJson.Values[c_SwagSecurityDefinitionOAuth2AuthorizationUrl]) then
fAuthorizationUrl := pJson.Values[c_SwagSecurityDefinitionOAuth2AuthorizationUrl].Value;
if Assigned(pJson.Values[c_SwagSecurityDefinitionOAuth2Flow]) then
fFlow := pJson.Values[c_SwagSecurityDefinitionOAuth2Flow].Value;
if Assigned(pJson.Values[c_SwagSecurityDefinitionOAuth2Scopes]) then
begin
vJsonScope := pJson.Values[c_SwagSecurityDefinitionOAuth2Scopes] as TJSONObject;
for vScopeIndex := 0 to vJsonScope.Count - 1 do
begin
vScope := TSwagSecurityDefinitionOAuth2Scope.Create;
vScope.Load(vJsonScope.Pairs[vScopeIndex]);
fScopes.Add(vScope);
end;
end;
end;
initialization
RegisterClass(TSwagSecurityDefinitionOAuth2);
end.

View File

@ -1,132 +0,0 @@
{******************************************************************************}
{ }
{ Delphi SwagDoc Library }
{ Copyright (c) 2018 Marcelo Jaloto }
{ https://github.com/marcelojaloto/SwagDoc }
{ }
{******************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{******************************************************************************}
unit Swag.Doc.Tags;
interface
uses
System.SysUtils,
System.JSON;
type
TSwagExternalDocs = class(TObject)
strict private
fDescription: string;
fUrl: string;
public
function GenerateJsonObject: TJSONObject;
procedure Load(pJson: TJSONObject);
property Description: string read fDescription write fDescription;
property Url: string read fUrl write FUrl;
end;
TSwagTag = class(TObject)
strict private
fName: string;
fDescription: string;
fExternalDocs: TSwagExternalDocs;
public
constructor Create;
destructor Destroy; override;
function GenerateJsonObject: TJSONObject;
procedure Load(pJson: TJSONObject);
property Name: string read fName write fName;
property Description: string read fDescription write fDescription;
property ExternalDocs: TSwagExternalDocs read fExternalDocs write fExternalDocs;
end;
implementation
const
c_SwagTagName = 'name';
c_SwagTagDescription = 'description';
c_SwagTagExternalDocs = 'externalDocs';
c_SwagTagNameUrl = 'url';
{ TSwagTag }
constructor TSwagTag.Create;
begin
inherited Create;
fExternalDocs := TSwagExternalDocs.Create;
end;
destructor TSwagTag.Destroy;
begin
FreeAndNil(fExternalDocs);
inherited Destroy;
end;
function TSwagTag.GenerateJsonObject: TJSONObject;
var
vExternalDocs: TJSONObject;
begin
Result := TJsonObject.Create;
if fName.Length > 0 then
Result.AddPair(c_SwagTagName, fName);
if fDescription.Length > 0 then
Result.AddPair(c_SwagTagDescription, fDescription);
vExternalDocs := fExternalDocs.GenerateJsonObject;
if Assigned(vExternalDocs) then
Result.AddPair(c_SwagTagExternalDocs, vExternalDocs);
end;
procedure TSwagTag.Load(pJson: TJSONObject);
begin
if not Assigned(pJson) then
Exit;
if Assigned(pJson.Values[c_SwagTagDescription]) then
fDescription := pJson.Values[c_SwagTagDescription].Value;
if Assigned(pJson.Values[c_SwagTagName]) then
fName := pJson.Values[c_SwagTagName].Value;
if Assigned(pJson.Values[c_SwagTagExternalDocs]) then
fExternalDocs.Load(pJson.Values[c_SwagTagExternalDocs] as TJSONObject);
end;
{ TSwagExternalDocs }
function TSwagExternalDocs.GenerateJsonObject: TJSONObject;
begin
Result := nil;
if (fDescription.Length = 0) and (fUrl.Length = 0) then
Exit;
Result := TJsonObject.Create;
if fDescription.Length > 0 then
Result.AddPair(c_SwagTagDescription, fDescription);
if fUrl.Length > 0 then
Result.AddPair(c_SwagTagNameUrl, fUrl);
end;
procedure TSwagExternalDocs.Load(pJson: TJSONObject);
begin
if Assigned(pJson.Values[c_SwagTagDescription]) then
fDescription := pJson.Values[c_SwagTagDescription].Value;
if Assigned(pJson.Values[c_SwagTagNameUrl]) then
fUrl := pJson.Values[c_SwagTagNameUrl].Value;
end;
end.

View File

@ -1,384 +0,0 @@
{******************************************************************************}
{ }
{ Delphi SwagDoc Library }
{ Copyright (c) 2018 Marcelo Jaloto }
{ https://github.com/marcelojaloto/SwagDoc }
{ }
{******************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{******************************************************************************}
unit Swag.Doc;
interface
uses
System.SysUtils,
System.Classes,
System.Generics.Collections,
System.JSON,
Swag.Common.Types,
Swag.Doc.Tags,
Swag.Doc.Info,
Swag.Doc.SecurityDefinition,
Swag.Doc.Path,
Swag.Doc.Path.Operation.RequestParameter,
Swag.Doc.Definition;
type
ESwagErrorLoadSwaggerJsonFile = class(Exception);
/// <summary>
/// This is the root document object for the API specification.
/// It combines what previously was the Resource Listing and API Declaration (version 1.2 and earlier) together into one document.
/// </summary>
TSwagDoc = class(TObject)
private
fInfo: TSwagInfo;
fTags: TObjectList<TSwagTag>;
fConsumes: TList<TSwagMimeType>;
fProduces: TList<TSwagMimeType>;
fBasePath: string;
fHost: string;
fSchemes: TSwagTransferProtocolSchemes;
fPaths: TObjectList<TSwagPath>;
fDefinitions: TObjectList<TSwagDefinition>;
fSecurityDefinitions: TObjectList<TSwagSecurityDefinition>;
fExternalDocs: TSwagExternalDocs;
fSwaggerJson: TJSONValue;
fSwaggerFilesFolder: string;
fParameters: TObjectList<TSwagRequestParameter>;
function GetSwaggerVersion: string;
procedure SetSwaggerFilesFolder(const Value: string);
function GenerateTagsJsonArray: TJSONArray;
protected
function GenerateSchemesJsonArray: TJSONArray;
function GenerateSecurityDefinitionsJsonObject: TJSONObject;
function GenerateConsumesJsonArray: TJSONArray;
function GenerateProducesJsonArray: TJSONArray;
function GeneratePathsJsonObject: TJSONObject;
function GenerateDefinitionsJsonObject: TJSONObject;
function GenerateParametersJsonObject: TJSONObject;
function GenerateMimeTypesJsonArray(pMimeTypesList: TList<TSwagMimeType>): TJSONArray;
function ReturnSwaggerFileName: string;
public
constructor Create; reintroduce;
destructor Destroy; override;
procedure GenerateSwaggerJson;
procedure SaveSwaggerJsonToFile;
procedure LoadFromFile(const pFilename: string);
property SwaggerFilesFolder: string read fSwaggerFilesFolder write SetSwaggerFilesFolder;
property SwaggerJson: TJSONValue read fSwaggerJson;
/// <summary>
/// Required. Specifies the Swagger Specification version being used.
/// It can be used by the Swagger UI and other clients to interpret the API listing. The value MUST be "2.0".
/// </summary>
property SwaggerVersion: string read GetSwaggerVersion;
/// <summary>
/// Required. Provides metadata about the API. The metadata can be used by the clients if needed.
/// </summary>
property Info: TSwagInfo read fInfo;
/// <summary>
/// The host (name or ip) serving the API. This MUST be the host only and does not include the scheme nor sub-paths.
/// It MAY include a port.
/// If the host is not included, the host serving the documentation is to be used (including the port).
/// The host does not support path templating.
/// </summary>
property Host: string read fHost write fHost;
/// <summary>
/// The base path on which the API is served, which is relative to the host.
/// If it is not included, the API is served directly under the host. The value MUST start with a leading slash (/).
/// The basePath does not support path templating.
/// </summary>
property BasePath: string read fBasePath write fBasePath;
/// <summary>
/// The transfer protocol of the API. Values MUST be from the list: "http", "https", "ws", "wss".
/// If the schemes is not included, the default scheme to be used is the one used to access the Swagger definition itself.
/// </summary>
property Schemes: TSwagTransferProtocolSchemes read fSchemes write fSchemes;
/// <summary>
/// A list of MIME types the APIs can consume. This is global to all APIs but can be overridden on specific API calls.
/// Value MUST be as described under Mime Types.
/// </summary>
property Consumes: TList<TSwagMimeType> read fConsumes;
/// <summary>
/// A list of MIME types the APIs can produce. This is global to all APIs but can be overridden on specific API calls.
/// Value MUST be as described under Mime Types.
/// </summary>
property Produces: TList<TSwagMimeType> read fProduces;
/// <summary>
/// Required. The available paths and operations for the API.
/// </summary>
property Paths: TObjectList<TSwagPath> read fPaths;
/// <summary>
/// An object to hold data types produced and consumed by operations.
/// </summary>
property Definitions: TObjectList<TSwagDefinition> read fDefinitions;
/// <summary>
/// Security scheme definitions that can be used across the specification.
/// </summary>
property SecurityDefinitions: TObjectList<TSwagSecurityDefinition> read fSecurityDefinitions;
property Parameters: TObjectList<TSwagRequestParameter> read fParameters;
property Tags: TObjectList<TSwagTag> read fTags;
property ExternalDocs: TSwagExternalDocs read fExternalDocs;
end;
const
c_Swagger = 'swagger';
c_SwagInfo = 'info';
c_SwagHost = 'host';
c_SwagBasePath = 'basePath';
c_SwagTags = 'tags';
c_SwagSchemes = 'schemes';
c_SwagSecurityDefinitions = 'securityDefinitions';
c_SwagSecurityDefinitionsType = 'type';
c_SwagConsumes = 'consumes';
c_SwagProduces = 'produces';
c_SwagPaths = 'paths';
c_SwagDefinitions = 'definitions';
c_SwagExternalDocs = 'externalDocs';
c_SwagExternalDocsDescription = 'description';
c_SwagExternalDocsUrl = 'url';
c_SwagParameters = 'parameters';
implementation
uses
System.IOUtils,
Json.Common.Helpers,
Swag.Common.Consts,
Swag.Common.Types.Helpers,
Swag.Doc.FileLoader;
{ TSwagDoc }
constructor TSwagDoc.Create;
begin
inherited Create;
fInfo := TSwagInfo.Create;
fTags := TObjectList<TSwagTag>.Create;
fSecurityDefinitions := TObjectList<TSwagSecurityDefinition>.Create;
fConsumes := TList<string>.Create;
fProduces := TList<string>.Create;
fPaths := TObjectList<TSwagPath>.Create;
fDefinitions := TObjectList<TSwagDefinition>.Create;
fExternalDocs := TSwagExternalDocs.Create;
fParameters := TObjectList<TSwagRequestParameter>.Create;
end;
destructor TSwagDoc.Destroy;
begin
FreeAndNil(fConsumes);
FreeAndNil(fProduces);
FreeAndNil(fDefinitions);
FreeAndNil(fPaths);
FreeAndNil(fInfo);
FreeAndNil(fTags);
FreeAndNil(fSecurityDefinitions);
FreeAndNil(fExternalDocs);
FreeAndNil(fParameters);
if Assigned(fSwaggerJson) then
FreeAndNil(fSwaggerJson);
inherited Destroy;
end;
procedure TSwagDoc.SaveSwaggerJsonToFile;
var
vJsonFile: TStringStream;
begin
if not Assigned(fSwaggerJson) then
Exit;
if not System.SysUtils.DirectoryExists(fSwaggerFilesFolder) then
System.SysUtils.ForceDirectories(fSwaggerFilesFolder);
vJsonFile := TStringStream.Create(fSwaggerJson.Format);
try
vJsonFile.SaveToFile(ReturnSwaggerFileName);
finally
FreeAndNil(vJsonFile);
end;
end;
function TSwagDoc.GenerateMimeTypesJsonArray(pMimeTypesList: TList<TSwagMimeType>): TJSONArray;
var
vIndex: Integer;
begin
Result := TJSONArray.Create;
for vIndex := 0 to pMimeTypesList.Count -1 do
Result.Add(pMimeTypesList.Items[vIndex]);
end;
function TSwagDoc.GenerateConsumesJsonArray: TJSONArray;
begin
Result := GenerateMimeTypesJsonArray(fConsumes);
end;
function TSwagDoc.GenerateProducesJsonArray: TJSONArray;
begin
Result := GenerateMimeTypesJsonArray(fProduces);
end;
function TSwagDoc.GenerateDefinitionsJsonObject: TJSONObject;
var
vIndex: integer;
begin
Result := TJsonObject.Create;
for vIndex := 0 to fDefinitions.Count -1 do
if Assigned(fDefinitions.Items[vIndex].JsonSchema) then
Result.AddPair(fDefinitions.Items[vIndex].Name, fDefinitions.Items[vIndex].JsonSchema.Clone as TJSONObject);
end;
function TSwagDoc.GenerateParametersJsonObject: TJSONObject;
var
vIndex: integer;
begin
Result := TJsonObject.Create;
for vIndex := 0 to fParameters.Count -1 do
Result.AddPair(fParameters.Items[vIndex].Name, fParameters.Items[vIndex].GenerateJsonObject);
end;
function TSwagDoc.GeneratePathsJsonObject: TJSONObject;
var
vIndex: integer;
begin
Result := TJsonObject.Create;
for vIndex := 0 to fPaths.Count -1 do
Result.AddPair(fPaths.Items[vIndex].Uri, fPaths.Items[vIndex].GenerateJsonObject);
end;
function TSwagDoc.GenerateTagsJsonArray: TJSONArray;
var
vTag: TSwagTag;
begin
Result := TJSONArray.Create;
for vTag in fTags do
begin
Result.Add(vTag.GenerateJsonObject);
end;
end;
function TSwagDoc.GenerateSchemesJsonArray: TJSONArray;
var
vScheme: TSwagTransferProtocolScheme;
begin
Result := TJSONArray.Create;
for vScheme := Low(TSwagTransferProtocolScheme) to high(TSwagTransferProtocolScheme) do
begin
if vScheme in fSchemes then
Result.Add(c_SwagTransferProtocolScheme[vScheme]);
end;
end;
function TSwagDoc.GenerateSecurityDefinitionsJsonObject: TJSONObject;
var
vIndex: integer;
begin
Result := TJsonObject.Create;
for vIndex := 0 to fSecurityDefinitions.Count -1 do
Result.AddPair(fSecurityDefinitions.Items[vIndex].SchemeName, fSecurityDefinitions.Items[vIndex].GenerateJsonObject);
end;
procedure TSwagDoc.GenerateSwaggerJson;
var
vJsonObject: TJsonObject;
begin
vJsonObject := TJsonObject.Create;
vJsonObject.AddPair(c_Swagger, GetSwaggerVersion);
vJsonObject.AddPair(c_SwagInfo, fInfo.GenerateJsonObject);
if not fHost.IsEmpty then
vJsonObject.AddPair(c_SwagHost, fHost);
vJsonObject.AddPair(c_SwagBasePath, fBasePath);
if (fTags.Count > 0) then
vJsonObject.AddPair(c_SwagTags, GenerateTagsJsonArray);
if (fSchemes <> []) then
vJsonObject.AddPair(c_SwagSchemes, GenerateSchemesJsonArray);
if (fConsumes.Count > 0) then
vJsonObject.AddPair(c_SwagConsumes, GenerateConsumesJsonArray);
if (fProduces.Count > 0) then
vJsonObject.AddPair(c_SwagProduces, GenerateProducesJsonArray);
if (fPaths.Count > 0) then
vJsonObject.AddPair(c_SwagPaths, GeneratePathsJsonObject);
if (fParameters.Count > 0) then
vJsonObject.AddPair(c_SwagParameters, GenerateParametersJsonObject);
if (fSecurityDefinitions.Count > 0) then
vJsonObject.AddPair(c_SwagSecurityDefinitions, GenerateSecurityDefinitionsJsonObject);
if (fDefinitions.Count > 0) then
vJsonObject.AddPair(c_SwagDefinitions, GenerateDefinitionsJsonObject);
if Assigned(fSwaggerJson) then
fSwaggerJson.Free;
fSwaggerJson := vJsonObject;
end;
function TSwagDoc.GetSwaggerVersion: string;
begin
Result := c_SwaggerVersion;
end;
procedure TSwagDoc.LoadFromFile(const pFilename: string);
var
vFileLoader: TSwagFileLoader;
begin
vFileLoader := TSwagFileLoader.Create(Self);
try
vFileLoader.Load(pFilename);
finally
vFileLoader.Free;
end;
end;
function TSwagDoc.ReturnSwaggerFileName: string;
begin
Result := fSwaggerFilesFolder + c_SwaggerFileName;
end;
procedure TSwagDoc.SetSwaggerFilesFolder(const Value: string);
begin
fSwaggerFilesFolder := IncludeTrailingPathDelimiter(Trim(Value));
end;
end.

View File

@ -1,67 +0,0 @@
package SwagDoc;
{$R *.res}
{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users}
{$ALIGN 8}
{$ASSERTIONS ON}
{$BOOLEVAL OFF}
{$DEBUGINFO OFF}
{$EXTENDEDSYNTAX ON}
{$IMPORTEDDATA ON}
{$IOCHECKS ON}
{$LOCALSYMBOLS ON}
{$LONGSTRINGS ON}
{$OPENSTRINGS ON}
{$OPTIMIZATION OFF}
{$OVERFLOWCHECKS OFF}
{$RANGECHECKS OFF}
{$REFERENCEINFO ON}
{$SAFEDIVIDE OFF}
{$STACKFRAMES ON}
{$TYPEDADDRESS OFF}
{$VARSTRINGCHECKS ON}
{$WRITEABLECONST OFF}
{$MINENUMSIZE 1}
{$IMAGEBASE $400000}
{$DEFINE DEBUG}
{$ENDIF IMPLICITBUILDING}
{$DESCRIPTION 'SwagDoc Library'}
{$RUNONLY}
{$IMPLICITBUILD ON}
requires
rtl;
contains
Json.Common.Helpers in 'Json.Common.Helpers.pas',
Json.Schema.Common.Types in 'Json.Schema.Common.Types.pas',
Json.Schema.Field in 'Json.Schema.Field.pas',
Json.Schema.Field.Booleans in 'Json.Schema.Field.Booleans.pas',
Json.Schema.Field.Numbers in 'Json.Schema.Field.Numbers.pas',
Json.Schema.Field.DateTimes in 'Json.Schema.Field.DateTimes.pas',
Json.Schema.Field.Arrays in 'Json.Schema.Field.Arrays.pas',
Json.Schema.Field.Objects in 'Json.Schema.Field.Objects.pas',
Json.Schema.Field.Enums in 'Json.Schema.Field.Enums.pas',
Json.Schema.Field.Strings in 'Json.Schema.Field.Strings.pas',
Json.Schema in 'Json.Schema.pas',
Swag.Common.Consts in 'Swag.Common.Consts.pas',
Swag.Common.Types.Helpers in 'Swag.Common.Types.Helpers.pas',
Swag.Common.Types in 'Swag.Common.Types.pas',
Swag.Doc.Definition in 'Swag.Doc.Definition.pas',
Swag.Doc.Info.Contact in 'Swag.Doc.Info.Contact.pas',
Swag.Doc.Info.License in 'Swag.Doc.Info.License.pas',
Swag.Doc.Info in 'Swag.Doc.Info.pas',
Swag.Doc.Path.Operation in 'Swag.Doc.Path.Operation.pas',
Swag.Doc.Path.Operation.RequestParameter in 'Swag.Doc.Path.Operation.RequestParameter.pas',
Swag.Doc.Path.Operation.Response in 'Swag.Doc.Path.Operation.Response.pas',
Swag.Doc.Path.Operation.ResponseHeaders in 'Swag.Doc.Path.Operation.ResponseHeaders.pas',
Swag.Doc.Path in 'Swag.Doc.Path.pas',
Swag.Doc.SecurityDefinition in 'Swag.Doc.SecurityDefinition.pas',
Swag.Doc.SecurityDefinitionApiKey in 'Swag.Doc.SecurityDefinitionApiKey.pas',
Swag.Doc.SecurityDefinitionBasic in 'Swag.Doc.SecurityDefinitionBasic.pas',
Swag.Doc.SecurityDefinitionOAuth2 in 'Swag.Doc.SecurityDefinitionOAuth2.pas',
Swag.Doc.Tags in 'Swag.Doc.Tags.pas',
Swag.Doc in 'Swag.Doc.pas',
Swag.Doc.FileLoader in 'Swag.Doc.FileLoader.pas';
end.

View File

@ -1,624 +0,0 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{5B9408E7-46AC-4431-9716-C9EB9F8589B1}</ProjectGuid>
<MainSource>SwagDoc.dpk</MainSource>
<ProjectVersion>18.6</ProjectVersion>
<FrameworkType>None</FrameworkType>
<Base>True</Base>
<Config Condition="'$(Config)'==''">Debug</Config>
<Platform Condition="'$(Platform)'==''">Win32</Platform>
<TargetedPlatforms>1</TargetedPlatforms>
<AppType>Package</AppType>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Android' and '$(Base)'=='true') or '$(Base_Android)'!=''">
<Base_Android>true</Base_Android>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='iOSDevice32' and '$(Base)'=='true') or '$(Base_iOSDevice32)'!=''">
<Base_iOSDevice32>true</Base_iOSDevice32>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='iOSDevice64' and '$(Base)'=='true') or '$(Base_iOSDevice64)'!=''">
<Base_iOSDevice64>true</Base_iOSDevice64>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='iOSSimulator' and '$(Base)'=='true') or '$(Base_iOSSimulator)'!=''">
<Base_iOSSimulator>true</Base_iOSSimulator>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
<Base_Win32>true</Base_Win32>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">
<Cfg_1>true</Cfg_1>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''">
<Cfg_1_Win32>true</Cfg_1_Win32>
<CfgParent>Cfg_1</CfgParent>
<Cfg_1>true</Cfg_1>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
<Cfg_2>true</Cfg_2>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''">
<DCC_DcuOutput>..\Lib</DCC_DcuOutput>
<DCC_ExeOutput>.\$(Platform)\$(Config)</DCC_ExeOutput>
<DCC_E>false</DCC_E>
<DCC_N>false</DCC_N>
<DCC_S>false</DCC_S>
<DCC_F>false</DCC_F>
<DCC_K>false</DCC_K>
<GenDll>true</GenDll>
<GenPackage>true</GenPackage>
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)</DCC_Namespace>
<DCC_CBuilderOutput>All</DCC_CBuilderOutput>
<SanitizedProjectName>SwagDoc</SanitizedProjectName>
<DCC_BplOutput>..\Lib</DCC_BplOutput>
<DCC_DcpOutput>..\Lib</DCC_DcpOutput>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_Release>3</VerInfo_Release>
<VerInfo_Locale>1046</VerInfo_Locale>
<VerInfo_Keys>CompanyName=Jaloto Software;FileDescription=$(MSBuildProjectName);FileVersion=1.0.3.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
<DCC_Description>SwagDoc Library</DCC_Description>
<RuntimeOnlyPackage>true</RuntimeOnlyPackage>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Android)'!=''">
<DCC_CBuilderOutput>None</DCC_CBuilderOutput>
<EnabledSysJars>android-support-v4.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar</EnabledSysJars>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_iOSDevice32)'!=''">
<DCC_CBuilderOutput>None</DCC_CBuilderOutput>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_iOSDevice64)'!=''">
<DCC_CBuilderOutput>None</DCC_CBuilderOutput>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_iOSSimulator)'!=''">
<DCC_CBuilderOutput>None</DCC_CBuilderOutput>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win32)'!=''">
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
<BT_BuildType>Debug</BT_BuildType>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
<VerInfo_Locale>1033</VerInfo_Locale>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1)'!=''">
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
<DCC_DebugDCUs>true</DCC_DebugDCUs>
<DCC_Optimize>false</DCC_Optimize>
<DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
<DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
<DCC_RemoteDebug>true</DCC_RemoteDebug>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
<DCC_RemoteDebug>false</DCC_RemoteDebug>
<VerInfo_Release>0</VerInfo_Release>
<VerInfo_Locale>1033</VerInfo_Locale>
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''">
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
<DCC_DebugInformation>0</DCC_DebugInformation>
</PropertyGroup>
<ItemGroup>
<DelphiCompile Include="$(MainSource)">
<MainSource>MainSource</MainSource>
</DelphiCompile>
<DCCReference Include="rtl.dcp"/>
<DCCReference Include="Json.Common.Helpers.pas"/>
<DCCReference Include="Json.Schema.Common.Types.pas"/>
<DCCReference Include="Json.Schema.Field.pas"/>
<DCCReference Include="Json.Schema.Field.Booleans.pas"/>
<DCCReference Include="Json.Schema.Field.Numbers.pas"/>
<DCCReference Include="Json.Schema.Field.DateTimes.pas"/>
<DCCReference Include="Json.Schema.Field.Arrays.pas"/>
<DCCReference Include="Json.Schema.Field.Objects.pas"/>
<DCCReference Include="Json.Schema.Field.Enums.pas"/>
<DCCReference Include="Json.Schema.Field.Strings.pas"/>
<DCCReference Include="Json.Schema.pas"/>
<DCCReference Include="Swag.Common.Consts.pas"/>
<DCCReference Include="Swag.Common.Types.Helpers.pas"/>
<DCCReference Include="Swag.Common.Types.pas"/>
<DCCReference Include="Swag.Doc.Definition.pas"/>
<DCCReference Include="Swag.Doc.Info.Contact.pas"/>
<DCCReference Include="Swag.Doc.Info.License.pas"/>
<DCCReference Include="Swag.Doc.Info.pas"/>
<DCCReference Include="Swag.Doc.Path.Operation.pas"/>
<DCCReference Include="Swag.Doc.Path.Operation.RequestParameter.pas"/>
<DCCReference Include="Swag.Doc.Path.Operation.Response.pas"/>
<DCCReference Include="Swag.Doc.Path.Operation.ResponseHeaders.pas"/>
<DCCReference Include="Swag.Doc.Path.pas"/>
<DCCReference Include="Swag.Doc.SecurityDefinition.pas"/>
<DCCReference Include="Swag.Doc.SecurityDefinitionApiKey.pas"/>
<DCCReference Include="Swag.Doc.SecurityDefinitionBasic.pas"/>
<DCCReference Include="Swag.Doc.SecurityDefinitionOAuth2.pas"/>
<DCCReference Include="Swag.Doc.Tags.pas"/>
<DCCReference Include="Swag.Doc.pas"/>
<DCCReference Include="Swag.Doc.FileLoader.pas"/>
<BuildConfiguration Include="Release">
<Key>Cfg_2</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
<BuildConfiguration Include="Base">
<Key>Base</Key>
</BuildConfiguration>
<BuildConfiguration Include="Debug">
<Key>Cfg_1</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
</ItemGroup>
<ProjectExtensions>
<Borland.Personality>Delphi.Personality.12</Borland.Personality>
<Borland.ProjectType>Package</Borland.ProjectType>
<BorlandProject>
<Delphi.Personality>
<Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k250.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dclofficexp250.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
</Excluded_Packages>
<Source>
<Source Name="MainSource">SwagDoc.dpk</Source>
</Source>
</Delphi.Personality>
<Deployment Version="3">
<DeployFile LocalName="$(BDS)\Redist\osx32\libcgunwind.1.0.dylib" Class="DependencyModule">
<Platform Name="OSX32">
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="..\Lib\SwagDoc.bpl" Configuration="Debug" Class="ProjectOutput">
<Platform Name="Win32">
<RemoteName>SwagDoc.bpl</RemoteName>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="$(BDS)\Redist\osx64\libcgsqlite3.dylib" Class="DependencyModule">
<Platform Name="OSX64">
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="$(BDS)\Redist\iossimulator\libPCRE.dylib" Class="DependencyModule">
<Platform Name="iOSSimulator">
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="$(BDS)\Redist\iossimulator\libcgunwind.1.0.dylib" Class="DependencyModule">
<Platform Name="iOSSimulator">
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="$(BDS)\Redist\iossimulator\libpcre.dylib" Class="DependencyModule">
<Platform Name="iOSSimulator">
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="$(BDS)\Redist\osx32\libcgsqlite3.dylib" Class="DependencyModule">
<Platform Name="OSX32">
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployClass Name="AdditionalDebugSymbols">
<Platform Name="OSX32">
<Operation>1</Operation>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidClassesDexFile">
<Platform Name="Android">
<RemoteDir>classes</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidFileProvider">
<Platform Name="Android">
<RemoteDir>res\xml</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidGDBServer">
<Platform Name="Android">
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidLibnativeArmeabiFile">
<Platform Name="Android">
<RemoteDir>library\lib\armeabi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidLibnativeMipsFile">
<Platform Name="Android">
<RemoteDir>library\lib\mips</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidServiceOutput">
<Platform Name="Android">
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidSplashImageDef">
<Platform Name="Android">
<RemoteDir>res\drawable</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidSplashStyles">
<Platform Name="Android">
<RemoteDir>res\values</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidSplashStylesV21">
<Platform Name="Android">
<RemoteDir>res\values-v21</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_DefaultAppIcon">
<Platform Name="Android">
<RemoteDir>res\drawable</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon144">
<Platform Name="Android">
<RemoteDir>res\drawable-xxhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon36">
<Platform Name="Android">
<RemoteDir>res\drawable-ldpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon48">
<Platform Name="Android">
<RemoteDir>res\drawable-mdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon72">
<Platform Name="Android">
<RemoteDir>res\drawable-hdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon96">
<Platform Name="Android">
<RemoteDir>res\drawable-xhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_SplashImage426">
<Platform Name="Android">
<RemoteDir>res\drawable-small</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_SplashImage470">
<Platform Name="Android">
<RemoteDir>res\drawable-normal</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_SplashImage640">
<Platform Name="Android">
<RemoteDir>res\drawable-large</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_SplashImage960">
<Platform Name="Android">
<RemoteDir>res\drawable-xlarge</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="DebugSymbols">
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="OSX32">
<Operation>1</Operation>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
</DeployClass>
<DeployClass Name="DependencyFramework">
<Platform Name="OSX32">
<Operation>1</Operation>
<Extensions>.framework</Extensions>
</Platform>
<Platform Name="OSX64">
<Operation>1</Operation>
<Extensions>.framework</Extensions>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
</DeployClass>
<DeployClass Name="DependencyModule">
<Platform Name="OSX32">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="OSX64">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
<Extensions>.dll;.bpl</Extensions>
</Platform>
</DeployClass>
<DeployClass Required="true" Name="DependencyPackage">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="OSX32">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="OSX64">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
<Extensions>.bpl</Extensions>
</Platform>
</DeployClass>
<DeployClass Name="File">
<Platform Name="Android">
<Operation>0</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>0</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>0</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>0</Operation>
</Platform>
<Platform Name="OSX32">
<Operation>0</Operation>
</Platform>
<Platform Name="OSX64">
<Operation>0</Operation>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_Launch1024">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_Launch1536">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_Launch2048">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_Launch768">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Launch320">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Launch640">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Launch640x1136">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectAndroidManifest">
<Platform Name="Android">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSDeviceDebug">
<Platform Name="iOSDevice32">
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSDeviceResourceRules"/>
<DeployClass Name="ProjectiOSEntitlements"/>
<DeployClass Name="ProjectiOSInfoPList"/>
<DeployClass Name="ProjectiOSResource">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectOSXDebug"/>
<DeployClass Name="ProjectOSXEntitlements"/>
<DeployClass Name="ProjectOSXInfoPList"/>
<DeployClass Name="ProjectOSXResource">
<Platform Name="OSX32">
<RemoteDir>Contents\Resources</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="OSX64">
<RemoteDir>Contents\Resources</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Required="true" Name="ProjectOutput">
<Platform Name="Android">
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="Linux64">
<Operation>1</Operation>
</Platform>
<Platform Name="OSX32">
<Operation>1</Operation>
</Platform>
<Platform Name="OSX64">
<Operation>1</Operation>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectUWPManifest">
<Platform Name="Win32">
<Operation>1</Operation>
</Platform>
<Platform Name="Win64">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="UWP_DelphiLogo150">
<Platform Name="Win32">
<RemoteDir>Assets</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Win64">
<RemoteDir>Assets</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="UWP_DelphiLogo44">
<Platform Name="Win32">
<RemoteDir>Assets</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Win64">
<RemoteDir>Assets</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="Linux64" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="OSX32" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="Android" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="OSX64" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>
</Deployment>
<Platforms>
<Platform value="Android">False</Platform>
<Platform value="iOSDevice32">False</Platform>
<Platform value="iOSDevice64">False</Platform>
<Platform value="iOSSimulator">False</Platform>
<Platform value="OSX32">False</Platform>
<Platform value="Win32">True</Platform>
<Platform value="Win64">False</Platform>
</Platforms>
</BorlandProject>
<ProjectFileVersion>12</ProjectFileVersion>
</ProjectExtensions>
<Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
<Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
<Import Project="$(MSBuildProjectName).deployproj" Condition="Exists('$(MSBuildProjectName).deployproj')"/>
</Project>

View File

@ -1,84 +0,0 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{3C1FCD51-30A3-4F2F-AF40-D8969DF3C49A}</ProjectGuid>
</PropertyGroup>
<ItemGroup>
<Projects Include="Source\SwagDoc.dproj">
<Dependencies/>
</Projects>
<Projects Include="Demos\GenerateSwaggerJsonFromCode\GenerateSwagger.dproj">
<Dependencies/>
</Projects>
<Projects Include="Demos\LoadSwaggerJsonToObject\LoadSwaggerJsonToObject.dproj">
<Dependencies/>
</Projects>
<Projects Include="Demos\SampleApi\SampleApi.dproj">
<Dependencies/>
</Projects>
<Projects Include="Demos\GenerateUnitFileForMVCFramework\GenerateUnitFileForMVCFramework.dproj">
<Dependencies/>
</Projects>
</ItemGroup>
<ProjectExtensions>
<Borland.Personality>Default.Personality.12</Borland.Personality>
<Borland.ProjectType/>
<BorlandProject>
<Default.Personality/>
</BorlandProject>
</ProjectExtensions>
<Target Name="SwagDoc">
<MSBuild Projects="Source\SwagDoc.dproj"/>
</Target>
<Target Name="SwagDoc:Clean">
<MSBuild Projects="Source\SwagDoc.dproj" Targets="Clean"/>
</Target>
<Target Name="SwagDoc:Make">
<MSBuild Projects="Source\SwagDoc.dproj" Targets="Make"/>
</Target>
<Target Name="GenerateSwagger">
<MSBuild Projects="Demos\GenerateSwaggerJsonFromCode\GenerateSwagger.dproj"/>
</Target>
<Target Name="GenerateSwagger:Clean">
<MSBuild Projects="Demos\GenerateSwaggerJsonFromCode\GenerateSwagger.dproj" Targets="Clean"/>
</Target>
<Target Name="GenerateSwagger:Make">
<MSBuild Projects="Demos\GenerateSwaggerJsonFromCode\GenerateSwagger.dproj" Targets="Make"/>
</Target>
<Target Name="LoadSwaggerJsonToObject">
<MSBuild Projects="Demos\LoadSwaggerJsonToObject\LoadSwaggerJsonToObject.dproj"/>
</Target>
<Target Name="LoadSwaggerJsonToObject:Clean">
<MSBuild Projects="Demos\LoadSwaggerJsonToObject\LoadSwaggerJsonToObject.dproj" Targets="Clean"/>
</Target>
<Target Name="LoadSwaggerJsonToObject:Make">
<MSBuild Projects="Demos\LoadSwaggerJsonToObject\LoadSwaggerJsonToObject.dproj" Targets="Make"/>
</Target>
<Target Name="SampleApi">
<MSBuild Projects="Demos\SampleApi\SampleApi.dproj"/>
</Target>
<Target Name="SampleApi:Clean">
<MSBuild Projects="Demos\SampleApi\SampleApi.dproj" Targets="Clean"/>
</Target>
<Target Name="SampleApi:Make">
<MSBuild Projects="Demos\SampleApi\SampleApi.dproj" Targets="Make"/>
</Target>
<Target Name="GenerateUnitFileForMVCFramework">
<MSBuild Projects="Demos\GenerateUnitFileForMVCFramework\GenerateUnitFileForMVCFramework.dproj"/>
</Target>
<Target Name="GenerateUnitFileForMVCFramework:Clean">
<MSBuild Projects="Demos\GenerateUnitFileForMVCFramework\GenerateUnitFileForMVCFramework.dproj" Targets="Clean"/>
</Target>
<Target Name="GenerateUnitFileForMVCFramework:Make">
<MSBuild Projects="Demos\GenerateUnitFileForMVCFramework\GenerateUnitFileForMVCFramework.dproj" Targets="Make"/>
</Target>
<Target Name="Build">
<CallTarget Targets="SwagDoc;GenerateSwagger;LoadSwaggerJsonToObject;SampleApi;GenerateUnitFileForMVCFramework"/>
</Target>
<Target Name="Clean">
<CallTarget Targets="SwagDoc:Clean;GenerateSwagger:Clean;LoadSwaggerJsonToObject:Clean;SampleApi:Clean;GenerateUnitFileForMVCFramework:Clean"/>
</Target>
<Target Name="Make">
<CallTarget Targets="SwagDoc:Make;GenerateSwagger:Make;LoadSwaggerJsonToObject:Make;SampleApi:Make;GenerateUnitFileForMVCFramework:Make"/>
</Target>
<Import Project="$(BDS)\Bin\CodeGear.Group.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Group.Targets')"/>
</Project>