├── .gitattributes
├── .github
├── FUNDING.yml
└── ISSUE_TEMPLATE
│ └── bug_report.md
├── .gitignore
├── CHANGELOG.md
├── CNAME
├── LICENSE.md
├── README.md
├── _config.yml
├── appveyor.yml
├── img
├── CompareOpenAPISpecificationsCommandResult.png
├── CompareOpenAPISpecificationsOneFileCommandMenu.png
├── CompareOpenAPISpecificationsTwoFilesCommandMenu.png
├── Csharp-Client-Generation-Exclude-Type-Names.png
├── Csharp-Client-Generation-OData.png
├── OpenWithNSwagCommandMenu.png
├── Unchase-OpenAPI-Connected-Service-ReportBug.png
├── Unchase-OpenAPI-Swagger-Connected-Service-Customize.gif
├── Unchase-OpenAPI-Swagger-Connected-Service-Logo.png
├── Unchase-OpenAPI-Swagger-Connected-Service-Settings-Meaning.png
├── Unchase-OpenAPI-Swagger-Connected-Service.gif
├── UnchaseOpenAPIConnectedServiceCommandsOptions1.png
├── UnchaseOpenAPIConnectedServiceCommandsOptions2.png
└── buymeacoffe.png
├── src
├── Unchase.OpenAPI.ConnectedService.sln
├── Unchase.OpenAPI.Connectedservice.Shared
│ ├── CodeGeneration
│ │ ├── BaseCodeGenDescriptor.cs
│ │ ├── NSwagCodeGenDescriptor.cs
│ │ └── OneOfOperationProcessor.cs
│ ├── Commands
│ │ ├── DiffSpecificationsCommand.cs
│ │ ├── OpenWithNSwagStudioCommand.cs
│ │ ├── OpenWithNSwagStudioCommandPackage.cs
│ │ ├── OpenWithNSwagStudioCommandPackage.vsct
│ │ ├── Resources
│ │ │ ├── OpenWithNSwagStudioCommand.png
│ │ │ └── OpenWithNSwagStudioCommandPackage.ico
│ │ └── VSPackage.resx
│ ├── Common
│ │ ├── Commands
│ │ │ └── StackPanelChangeVisibilityCommand.cs
│ │ ├── ExtensionsHelper.cs
│ │ ├── LoggerHelper.cs
│ │ ├── ProjectHelper.cs
│ │ └── UserSettingsPersistenceHelper.cs
│ ├── Constants.cs
│ ├── Converters
│ │ ├── EqualityConverter.cs
│ │ ├── NotConverter.cs
│ │ ├── NotNullOrWhiteSpaceConverter.cs
│ │ ├── SharedImageSourceExtension.cs
│ │ ├── StringArrayConverter.cs
│ │ ├── VisibilityConverter.cs
│ │ └── VisibilityToHyperlinkTextConverter.cs
│ ├── Handler.cs
│ ├── Instance.cs
│ ├── Models
│ │ ├── ServiceConfiguration.cs
│ │ └── UserSettings.cs
│ ├── Options.cs
│ ├── Provider.cs
│ ├── Resources
│ │ ├── EULA.txt
│ │ ├── NewBug.png
│ │ ├── favicon.ico
│ │ ├── logo_128x128.png
│ │ └── preview_200x200.png
│ ├── Unchase.OpenAPI.Connectedservice.Shared.projitems
│ ├── Unchase.OpenAPI.Connectedservice.Shared.shproj
│ ├── ViewModels
│ │ ├── CSharpClientSettingsViewModel.cs
│ │ ├── CSharpControllerSettingsViewModel.cs
│ │ ├── ConfigOpenApiEndpointViewModel.cs
│ │ └── TypeScriptClientSettingsViewModel.cs
│ ├── Views
│ │ ├── CSharpClientExcludedClasses.xaml
│ │ ├── CSharpClientExcludedClasses.xaml.cs
│ │ ├── CSharpClientSettings.xaml
│ │ ├── CSharpClientSettings.xaml.cs
│ │ ├── CSharpControllerSettings.xaml
│ │ ├── CSharpControllerSettings.xaml.cs
│ │ ├── ConfigOpenApiEndpoint.xaml
│ │ ├── ConfigOpenApiEndpoint.xaml.cs
│ │ ├── TypeScriptClientSettings.xaml
│ │ └── TypeScriptClientSettings.xaml.cs
│ └── Wizard.cs
├── Unchase.OpenAPI.Connectedservice.VS22
│ ├── EULA.txt
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ └── Resources.resx
│ ├── Resources
│ │ ├── logo_128x128.png
│ │ └── preview_200x200.png
│ ├── Unchase.OpenAPI.Connectedservice.VS22.csproj
│ └── source.extension.vsixmanifest
└── Unchase.OpenAPI.Connectedservice
│ ├── EULA.txt
│ ├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ └── Resources.resx
│ ├── Resources
│ ├── logo_128x128.png
│ └── preview_200x200.png
│ ├── Unchase.OpenAPI.ConnectedService.csproj
│ ├── app.config
│ ├── packages.config
│ ├── source.extension.vsixmanifest
│ └── vs-threading.MembersRequiringMainThread.txt
└── vsix.ps1
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: [unchase]
4 | patreon: # Replace with a single Patreon username
5 | open_collective: # Replace with a single Open Collective username
6 | ko_fi: # Replace with a single Ko-fi username
7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9 | liberapay: # Replace with a single Liberapay username
10 | issuehunt: # Replace with a single IssueHunt username
11 | otechie: # Replace with a single Otechie username
12 | custom: https://www.buymeacoffee.com/nikolaychebotov
13 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: BUG
5 | labels: bug
6 | assignees: ''
7 |
8 | ---
9 |
10 | ### Describe the bug
11 | A clear and concise description of what the bug is.
12 | *Short summary (3-5 sentences) describing the issue.*
13 |
14 | ### Assemblies affected
15 |
16 | *Which assemblies and versions are known to be affected?*
17 |
18 | ### Steps to reproduce
19 |
20 | *The simplest set of steps to reproduce the issue. If possible, reference a commit that demonstrates the issue:*
21 |
22 | 1. Go to '...'
23 | 2. Click on '....'
24 | 3. Scroll down to '....'
25 | 4. See error
26 | ...
27 |
28 | ### Expected result
29 |
30 | A clear and concise description of what you expected to happen.
31 | *What would happen if there wasn't a bug.*
32 |
33 | ### Actual result
34 |
35 | *What is actually happening.*
36 |
37 | ### Screenshots
38 |
39 | If applicable, add screenshots to help explain your problem.
40 |
41 | ### Additional detail
42 |
43 | Add any other context about the problem here.
44 | *Optional, details of the root cause if known.*
45 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | bld/
21 | [Bb]in/
22 | [Oo]bj/
23 | [Ll]og/
24 |
25 | # Visual Studio 2015 cache/options directory
26 | .vs/
27 | # Uncomment if you have tasks that create the project's static files in wwwroot
28 | #wwwroot/
29 |
30 | # MSTest test Results
31 | [Tt]est[Rr]esult*/
32 | [Bb]uild[Ll]og.*
33 |
34 | # NUNIT
35 | *.VisualState.xml
36 | TestResult.xml
37 |
38 | # Build Results of an ATL Project
39 | [Dd]ebugPS/
40 | [Rr]eleasePS/
41 | dlldata.c
42 |
43 | # DNX
44 | project.lock.json
45 | project.fragment.lock.json
46 | artifacts/
47 |
48 | *_i.c
49 | *_p.c
50 | *_i.h
51 | *.ilk
52 | *.meta
53 | *.obj
54 | *.pch
55 | *.pdb
56 | *.pgc
57 | *.pgd
58 | *.rsp
59 | *.sbr
60 | *.tlb
61 | *.tli
62 | *.tlh
63 | *.tmp
64 | *.tmp_proj
65 | *.log
66 | *.vspscc
67 | *.vssscc
68 | .builds
69 | *.pidb
70 | *.svclog
71 | *.scc
72 |
73 | # Chutzpah Test files
74 | _Chutzpah*
75 |
76 | # Visual C++ cache files
77 | ipch/
78 | *.aps
79 | *.ncb
80 | *.opendb
81 | *.opensdf
82 | *.sdf
83 | *.cachefile
84 | *.VC.db
85 | *.VC.VC.opendb
86 |
87 | # Visual Studio profiler
88 | *.psess
89 | *.vsp
90 | *.vspx
91 | *.sap
92 |
93 | # TFS 2012 Local Workspace
94 | $tf/
95 |
96 | # Guidance Automation Toolkit
97 | *.gpState
98 |
99 | # ReSharper is a .NET coding add-in
100 | _ReSharper*/
101 | *.[Rr]e[Ss]harper
102 | *.DotSettings.user
103 |
104 | # JustCode is a .NET coding add-in
105 | .JustCode
106 |
107 | # TeamCity is a build add-in
108 | _TeamCity*
109 |
110 | # DotCover is a Code Coverage Tool
111 | *.dotCover
112 |
113 | # NCrunch
114 | _NCrunch_*
115 | .*crunch*.local.xml
116 | nCrunchTemp_*
117 |
118 | # MightyMoose
119 | *.mm.*
120 | AutoTest.Net/
121 |
122 | # Web workbench (sass)
123 | .sass-cache/
124 |
125 | # Installshield output folder
126 | [Ee]xpress/
127 |
128 | # DocProject is a documentation generator add-in
129 | DocProject/buildhelp/
130 | DocProject/Help/*.HxT
131 | DocProject/Help/*.HxC
132 | DocProject/Help/*.hhc
133 | DocProject/Help/*.hhk
134 | DocProject/Help/*.hhp
135 | DocProject/Help/Html2
136 | DocProject/Help/html
137 |
138 | # Click-Once directory
139 | publish/
140 |
141 | # Publish Web Output
142 | *.[Pp]ublish.xml
143 | *.azurePubxml
144 | # TODO: Comment the next line if you want to checkin your web deploy settings
145 | # but database connection strings (with potential passwords) will be unencrypted
146 | #*.pubxml
147 | *.publishproj
148 |
149 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
150 | # checkin your Azure Web App publish settings, but sensitive information contained
151 | # in these scripts will be unencrypted
152 | PublishScripts/
153 |
154 | # NuGet Packages
155 | *.nupkg
156 | # The packages folder can be ignored because of Package Restore
157 | **/packages/*
158 | # except build/, which is used as an MSBuild target.
159 | !**/packages/build/
160 | # Uncomment if necessary however generally it will be regenerated when needed
161 | #!**/packages/repositories.config
162 | # NuGet v3's project.json files produces more ignoreable files
163 | *.nuget.props
164 | *.nuget.targets
165 |
166 | # Microsoft Azure Build Output
167 | csx/
168 | *.build.csdef
169 |
170 | # Microsoft Azure Emulator
171 | ecf/
172 | rcf/
173 |
174 | # Windows Store app package directories and files
175 | AppPackages/
176 | BundleArtifacts/
177 | Package.StoreAssociation.xml
178 | _pkginfo.txt
179 |
180 | # Visual Studio cache files
181 | # files ending in .cache can be ignored
182 | *.[Cc]ache
183 | # but keep track of directories ending in .cache
184 | !*.[Cc]ache/
185 |
186 | # Others
187 | ClientBin/
188 | ~$*
189 | *~
190 | *.dbmdl
191 | *.dbproj.schemaview
192 | *.jfm
193 | *.pfx
194 | *.publishsettings
195 | node_modules/
196 | orleans.codegen.cs
197 |
198 | # Since there are multiple workflows, uncomment next line to ignore bower_components
199 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
200 | #bower_components/
201 |
202 | # RIA/Silverlight projects
203 | Generated_Code/
204 |
205 | # Backup & report files from converting an old project file
206 | # to a newer Visual Studio version. Backup files are not needed,
207 | # because we have git ;-)
208 | _UpgradeReport_Files/
209 | Backup*/
210 | UpgradeLog*.XML
211 | UpgradeLog*.htm
212 |
213 | # SQL Server files
214 | *.mdf
215 | *.ldf
216 |
217 | # Business Intelligence projects
218 | *.rdl.data
219 | *.bim.layout
220 | *.bim_*.settings
221 |
222 | # Microsoft Fakes
223 | FakesAssemblies/
224 |
225 | # GhostDoc plugin setting file
226 | *.GhostDoc.xml
227 |
228 | # Node.js Tools for Visual Studio
229 | .ntvs_analysis.dat
230 |
231 | # Visual Studio 6 build log
232 | *.plg
233 |
234 | # Visual Studio 6 workspace options file
235 | *.opt
236 |
237 | # Visual Studio LightSwitch build output
238 | **/*.HTMLClient/GeneratedArtifacts
239 | **/*.DesktopClient/GeneratedArtifacts
240 | **/*.DesktopClient/ModelManifest.xml
241 | **/*.Server/GeneratedArtifacts
242 | **/*.Server/ModelManifest.xml
243 | _Pvt_Extensions
244 |
245 | # Paket dependency manager
246 | .paket/paket.exe
247 | paket-files/
248 |
249 | # FAKE - F# Make
250 | .fake/
251 |
252 | # JetBrains Rider
253 | .idea/
254 | *.sln.iml
255 |
256 | # CodeRush
257 | .cr/
258 |
259 | # Python Tools for Visual Studio (PTVS)
260 | __pycache__/
261 | *.pyc
--------------------------------------------------------------------------------
/CNAME:
--------------------------------------------------------------------------------
1 | openapi.unchase.ru
2 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright 2019 Nikolay Chebotov (Unchase)
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 
2 |
3 | [Unchase OpenAPI (Swagger) Connected Service](https://marketplace.visualstudio.com/items?itemName=Unchase.unchaseOpenAPIConnectedService) is a Visual Studio 2017/2019/2022 extension to generate `C#` (`TypeScript`) `HttpClient` (or `C#` `Controllers`) code for `OpenAPI` (formerly [`Swagger API`](https://swagger.io/docs/specification/about/)) web service with [NSwag](https://github.com/RSuter/NSwag).
4 |
5 | > Starting from Visual Studio Community 2019 v16.1.3 extensions based on `Microsoft Connected Services` now work fine.
6 |
7 | > The project is developed and maintained by [Nikolay Chebotov (**Unchase**)](https://github.com/unchase).
8 |
9 | ## Getting Started
10 |
11 | #### **[Read How-To on medium.com](https://medium.com/@unchase/how-to-generate-c-or-typescript-client-code-for-openapi-swagger-specification-d882d59e3b77)**
12 |
13 | Install from `Tools -> Extensions and Updates` menu inside [Visual Studio](https://visualstudio.microsoft.com/vs/) 2017 (for [VisualStudio](https://visualstudio.microsoft.com/vs/) 2019: `Extensions -> Manage Extensions`) or [download](http://vsixgallery.com/extensions/Unchase.OpenAPI.ConnectedService.63199638-6211-4285-ba8f-75b1f0326c2a/extension.vsix) as `VSIX` package from VSGallery or [download](https://marketplace.visualstudio.com/items?itemName=unchase.unchaseOpenAPIConnectedService) as `VSIX` package from [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=Unchase.unchaseopenapiconnectedservice):
14 |
15 | 
16 |
17 | ## Builds status
18 |
19 | |Status|Value|
20 | |:----|:---:|
21 | |Build|[](https://ci.appveyor.com/project/unchase/unchase.openapi.connectedservice)
22 | |Buid History|
23 | |GitHub Release|[](https://github.com/unchase/Unchase.OpenAPI.Connectedservice/releases/latest)
24 | |GitHub Release Date|[](https://github.com/unchase/Unchase.OpenAPI.Connectedservice/releases/latest)
25 | |GitHub Release Downloads|[](https://github.com/unchase/Unchase.OpenAPI.Connectedservice/releases/latest)
26 | |VS Marketplace|[](https://marketplace.visualstudio.com/items?itemName=unchase.unchaseOpenAPIConnectedService)
27 | |VS Marketplace Downloads|[](https://marketplace.visualstudio.com/items?itemName=unchase.unchaseOpenAPIConnectedService)
28 | |VS Marketplace Installs|[](https://marketplace.visualstudio.com/items?itemName=unchase.unchaseOpenAPIConnectedService)
29 |
30 | ## Features
31 |
32 | - Generate `C#` or `TypeScript` clients/proxies (client code) from Swagger 2.0 and OpenAPI 3.0 specifications
33 | - Generate `C#` ASP.NET Controller from Swagger 2.0 and OpenAPI 3.0 specifications
34 | - **Experimental**: Generate `C#` or `TypeScript` clients/proxies (client code) or ASP.NET Controller from OData specification converted to OpenAPI based on [OpenAPI.NET.OData](https://github.com/microsoft/OpenAPI.NET.OData)
35 | - Generate `.nswag` file for using in [`NSwagStudio`](https://github.com/NSwag/NSwag/wiki/NSwagStudio) (no need to install for generating)
36 | - Add required dependencies for the `C#` client (before generating):
37 | - Library targeting .NET Standard 1.4+:
38 | 1. Newtonsoft.Json ([NuGet](https://www.nuget.org/packages/Newtonsoft.Json))
39 | 2. System.Net.Http ([NuGet](https://www.nuget.org/packages/System.Net.Http))
40 | 3. System.ComponentModel.Annotations ([NuGet](https://www.nuget.org/packages/System.ComponentModel.Annotations))
41 | - Library targeting the full .NET:
42 | 1. Newtonsoft.Json ([NuGet](https://www.nuget.org/packages/Newtonsoft.Json))
43 | 2. System.Runtime.Serialization (GAC)
44 | 3. System.ComponentModel.DataAnnotations (GAC)
45 | - Library targeting PCL 259 (Portable Class Library):
46 | 1. Newtonsoft.Json ([NuGet](https://www.nuget.org/packages/Newtonsoft.Json))
47 | 2. Microsoft.Net.Http ([NuGet](https://www.nuget.org/packages/Microsoft.Net.Http))
48 | 3. Portable.DataAnnotations ([NuGet](https://www.nuget.org/packages/Portable.DataAnnotations))
49 | - Add Required dependences for the `C#` controller (before generating):
50 | 1. Microsoft.AspNetCore.Mvc ([NuGet](https://www.nuget.org/packages/Microsoft.AspNetCore.MVC))
51 | - **Command** to open generated `.nswag` and `.nswag.json` files in [NSWagStudio](https://github.com/NSwag/NSwag/wiki/NSwagStudio)
52 | - **Command** to compare `.nswag.json` specification file with another `.nswag.json` specification file (or specification given by `endpoint`)
53 | - Storage of the last 10 endpoints (specification path)
54 |
55 | ## Settings Meaning
56 |
57 | Meaning of the Unchase [OpenAPI (Swagger) Connected Service](https://marketplace.visualstudio.com/items?itemName=unchase.unchaseOpenAPIConnectedService) settings according to [NSwagStudio](https://github.com/NSwag/NSwag/wiki/NSwagStudio):
58 |
59 | 
60 |
61 | ## Exclude type names
62 |
63 | Since [v1.4.0](https://github.com/unchase/Unchase.OpenAPI.Connectedservice/releases/tag/v1.4.0) you can exclude type names in separate Window for C# client code generation:
64 |
65 | 
66 |
67 | ## Generate code from OData specification converted to OpenAPI specification
68 |
69 | Since [v1.5.0](https://github.com/unchase/Unchase.OpenAPI.Connectedservice/releases/tag/v1.4.0) you can generate code from OData specification converted to OpenAPI specification:
70 |
71 | 
72 |
73 | ## Custom Commands
74 |
75 | ### `Open in NSwagStudio` Command
76 |
77 | Since *v1.1.** have been added menu command embedded in Visual Studio Solution Explorer context menu lets you open generated `.nswag` and `.nswag.json` files in [NSwagStudio](https://github.com/NSwag/NSwag/wiki/NSwagStudio).
78 |
79 | This extension is for those times where you generate `.nswag` and `.nswag.json` files and you want to be able to quickly open it in [NSwagStudio](https://github.com/NSwag/NSwag/wiki/NSwagStudio).
80 |
81 | #### Prerequisite
82 |
83 | > In order to use this extension, you must have [Visual Studio](https://visualstudio.microsoft.com/vs/) 2017/2019, this connected service as well as [NSwagStudio](https://github.com/NSwag/NSwag/wiki/NSwagStudio) installed.
84 |
85 | #### Solution Explorer
86 |
87 | You can open `.nswag` and `.nswag.json` files in [NSWagStudio](https://github.com/NSwag/NSwag/wiki/NSwagStudio) by simply right-clicking it in Solution Explorer and select **Open in NSwagStudio**:
88 |
89 | 
90 |
91 | #### Path to NSwagStudio.exe
92 |
93 | If you installed [NSwagStudio](https://github.com/NSwag/NSwag/wiki/NSwagStudio) at a non-default location, a prompt will ask for the path to `NSwagStudio.exe`.
94 |
95 | You can always change the location in *Tools -> Options -> Web -> Unchase OpenAPI (Swagger) Connected Service*:
96 |
97 | 
98 |
99 | ### `Compare OpenAPI-specifications...` Command
100 |
101 | Since *v1.2.** have been added menu command embedded in Visual Studio Solution Explorer context menu lets you compare generated `.nswag.json` specification-file with another `.nswag.json` specification-file (or with specification given by `endpoint`).
102 |
103 | This extension is for those times where you generate `.nswag.json` file and you want to quickly compare it with another specification or specification given by `endpoint`.
104 |
105 | #### Prerequisite
106 |
107 | > In order to use this extension, you must have [Visual Studio](https://visualstudio.microsoft.com/vs/) 2017/2019 as well as this connected service.
108 |
109 | #### Solution Explorer
110 |
111 | You can compare `.nswag.json` specification-file with another `.nswag.json` specification-file (or with specification given by `endpoint`) by simply selecting one or two files and right-clicking them in Solution Explorer and select **Compare OpenAPI-specifications...**:
112 |
113 |  
114 |
115 | #### Path to the specification `Endpoint`
116 |
117 | You can always change the specification Endpoint to compare with in *Tools -> Options -> Web -> Unchase OpenAPI (Swagger) Connected Service*:
118 |
119 | 
120 |
121 | #### Compare View
122 |
123 | 
124 |
125 | ## HowTos
126 |
127 | - [ ] Add HowTos in a future
128 | - [ ] ... [request for HowTo you need](https://github.com/unchase/Unchase.OpenAPI.Connectedservice/issues/new?title=DOC)
129 |
130 | ## Troubleshooting
131 |
132 | ### Can't open .nswag file in NSwagStudio
133 |
134 | - You can use **Open in NSwagStudio** menu command
135 | - If generated code corrupted, try to open `.nswag` file in [`NSwagStudio`](https://github.com/RSuter/NSwag/wiki/NSwagStudio) (Windows GUI for editing .*nswag files)
136 | - If it doesn't open, try to create new `.nswag` file in [`NSwagStudio`](https://github.com/RSuter/NSwag/wiki/NSwagStudio) for the same API service link and check the differences
137 |
138 | ### Installation completes but I can't see the Service in the list of connected services (Visual Studio 2019)
139 |
140 | - Relevant [bug report](https://developercommunity.visualstudio.com/content/problem/468751/vs2019-preview-cannot-install-connected-service-ex.html). `Connected Services` restored in the v16.1.3 update to [Visual Studio](https://visualstudio.microsoft.com/vs/) 2019.
141 |
142 | ## Roadmap
143 |
144 | See the [changelog](CHANGELOG.md) for the further development plans and version history.
145 |
146 | ## Feedback
147 |
148 | Please feel free to add your [review](https://marketplace.visualstudio.com/items?itemName=unchase.unchaseOpenAPIConnectedService&ssr=false#review-details), [request a feature](https://github.com/unchase/Unchase.OpenAPI.Connectedservice/issues/new?title=FEATURE), [ask a question](https://marketplace.visualstudio.com/items?itemName=unchase.unchaseOpenAPIConnectedService&ssr=false#qna) or [report a bug](https://github.com/unchase/Unchase.OpenAPI.Connectedservice/issues/new?title=BUG) including in connected service:
149 |
150 | 
151 |
152 | Thank you in advance!
153 |
154 | ## Thank me!
155 |
156 | If you like what I am doing and you would like to thank me, please consider:
157 |
158 | [](https://www.buymeacoffee.com/nikolaychebotov)
159 |
160 | Thank you for your support!
161 |
162 | ----------
163 |
164 | Copyright © 2019 [Nikolay Chebotov (**Unchase**)](https://github.com/unchase) - Provided under the [Apache License 2.0](LICENSE.md).
165 |
166 |
--------------------------------------------------------------------------------
/_config.yml:
--------------------------------------------------------------------------------
1 | theme: jekyll-theme-cayman
--------------------------------------------------------------------------------
/appveyor.yml:
--------------------------------------------------------------------------------
1 | version: 1.9.{build}
2 | pull_requests:
3 | do_not_increment_build_number: true
4 | skip_tags: true
5 | image: Visual Studio 2022
6 | platform: Any CPU
7 | build:
8 | verbosity: minimal
9 | configuration: Release
10 | install:
11 | - ps: (new-object Net.WebClient).DownloadString("https://raw.githubusercontent.com/unchase/Unchase.OpenAPI.Connectedservice/master/vsix.ps1") | iex
12 | before_build:
13 | - ps: nuget restore src\Unchase.OpenAPI.ConnectedService.sln
14 | - ps: Vsix-IncrementVsixVersion | Vsix-UpdateBuildVersion
15 | build_script:
16 | - msbuild src\Unchase.OpenAPI.ConnectedService.sln /p:configuration=Release /p:DeployExtension=false /p:ZipPackageCompressionLevel=normal /v:m
17 | after_test:
18 | - ps: Vsix-PushArtifacts | Vsix-PublishToGallery
19 | deploy:
20 | - provider: GitHub
21 | tag: v$(appveyor_build_version)
22 | release: Unchase.OpenAPI.ConnectedService-v$(appveyor_build_version)
23 | auth_token:
24 | secure: 5YjB5tKbw0Z/mnSTKxo3WLD9TWuyGpGPhaNlSTA+cFA1oORUk46i6tPuyvekHaS9
25 | repository: unchase/Unchase.OpenAPI.ConnectedService
26 | artifact: /.*\.vsix/
27 | force_update: true
28 | # on:
29 | #branch: master # release from master branch only
30 | #appveyor_repo_tag: false # deploy on tag push only
31 | notifications:
32 | - provider: Email
33 | to:
34 | - spiritkola@hotmail.com
35 | subject: 'Unchase.OpenAPI.ConnectedService - Build {{status}}'
36 | message: "Building complete, commitId = {{commitId}}"
37 | on_build_status_changed: true
--------------------------------------------------------------------------------
/img/CompareOpenAPISpecificationsCommandResult.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unchase/Unchase.OpenAPI.Connectedservice/125976bb4c05817d8afe2d0f47b0c2f8a3b714f5/img/CompareOpenAPISpecificationsCommandResult.png
--------------------------------------------------------------------------------
/img/CompareOpenAPISpecificationsOneFileCommandMenu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unchase/Unchase.OpenAPI.Connectedservice/125976bb4c05817d8afe2d0f47b0c2f8a3b714f5/img/CompareOpenAPISpecificationsOneFileCommandMenu.png
--------------------------------------------------------------------------------
/img/CompareOpenAPISpecificationsTwoFilesCommandMenu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unchase/Unchase.OpenAPI.Connectedservice/125976bb4c05817d8afe2d0f47b0c2f8a3b714f5/img/CompareOpenAPISpecificationsTwoFilesCommandMenu.png
--------------------------------------------------------------------------------
/img/Csharp-Client-Generation-Exclude-Type-Names.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unchase/Unchase.OpenAPI.Connectedservice/125976bb4c05817d8afe2d0f47b0c2f8a3b714f5/img/Csharp-Client-Generation-Exclude-Type-Names.png
--------------------------------------------------------------------------------
/img/Csharp-Client-Generation-OData.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unchase/Unchase.OpenAPI.Connectedservice/125976bb4c05817d8afe2d0f47b0c2f8a3b714f5/img/Csharp-Client-Generation-OData.png
--------------------------------------------------------------------------------
/img/OpenWithNSwagCommandMenu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unchase/Unchase.OpenAPI.Connectedservice/125976bb4c05817d8afe2d0f47b0c2f8a3b714f5/img/OpenWithNSwagCommandMenu.png
--------------------------------------------------------------------------------
/img/Unchase-OpenAPI-Connected-Service-ReportBug.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unchase/Unchase.OpenAPI.Connectedservice/125976bb4c05817d8afe2d0f47b0c2f8a3b714f5/img/Unchase-OpenAPI-Connected-Service-ReportBug.png
--------------------------------------------------------------------------------
/img/Unchase-OpenAPI-Swagger-Connected-Service-Customize.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unchase/Unchase.OpenAPI.Connectedservice/125976bb4c05817d8afe2d0f47b0c2f8a3b714f5/img/Unchase-OpenAPI-Swagger-Connected-Service-Customize.gif
--------------------------------------------------------------------------------
/img/Unchase-OpenAPI-Swagger-Connected-Service-Logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unchase/Unchase.OpenAPI.Connectedservice/125976bb4c05817d8afe2d0f47b0c2f8a3b714f5/img/Unchase-OpenAPI-Swagger-Connected-Service-Logo.png
--------------------------------------------------------------------------------
/img/Unchase-OpenAPI-Swagger-Connected-Service-Settings-Meaning.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unchase/Unchase.OpenAPI.Connectedservice/125976bb4c05817d8afe2d0f47b0c2f8a3b714f5/img/Unchase-OpenAPI-Swagger-Connected-Service-Settings-Meaning.png
--------------------------------------------------------------------------------
/img/Unchase-OpenAPI-Swagger-Connected-Service.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unchase/Unchase.OpenAPI.Connectedservice/125976bb4c05817d8afe2d0f47b0c2f8a3b714f5/img/Unchase-OpenAPI-Swagger-Connected-Service.gif
--------------------------------------------------------------------------------
/img/UnchaseOpenAPIConnectedServiceCommandsOptions1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unchase/Unchase.OpenAPI.Connectedservice/125976bb4c05817d8afe2d0f47b0c2f8a3b714f5/img/UnchaseOpenAPIConnectedServiceCommandsOptions1.png
--------------------------------------------------------------------------------
/img/UnchaseOpenAPIConnectedServiceCommandsOptions2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unchase/Unchase.OpenAPI.Connectedservice/125976bb4c05817d8afe2d0f47b0c2f8a3b714f5/img/UnchaseOpenAPIConnectedServiceCommandsOptions2.png
--------------------------------------------------------------------------------
/img/buymeacoffe.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unchase/Unchase.OpenAPI.Connectedservice/125976bb4c05817d8afe2d0f47b0c2f8a3b714f5/img/buymeacoffe.png
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.ConnectedService.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.33423.255
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unchase.OpenAPI.ConnectedService", "Unchase.OpenAPI.ConnectedService\Unchase.OpenAPI.ConnectedService.csproj", "{CFB451DE-8645-4125-8254-3C3BEB6C6CC7}"
7 | EndProject
8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sln", "sln", "{2E792B87-132B-4E5F-B542-86E96D18FAD8}"
9 | ProjectSection(SolutionItems) = preProject
10 | ..\.gitignore = ..\.gitignore
11 | ..\appveyor.yml = ..\appveyor.yml
12 | ..\CHANGELOG.md = ..\CHANGELOG.md
13 | ..\CNAME = ..\CNAME
14 | ..\LICENSE.md = ..\LICENSE.md
15 | ..\README.md = ..\README.md
16 | EndProjectSection
17 | EndProject
18 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "img", "img", "{FEC756D6-3315-4914-B04F-B2CEA3F6A7F6}"
19 | ProjectSection(SolutionItems) = preProject
20 | ..\img\buymeacoffe.png = ..\img\buymeacoffe.png
21 | ..\img\CompareOpenAPISpecificationsCommandResult.png = ..\img\CompareOpenAPISpecificationsCommandResult.png
22 | ..\img\CompareOpenAPISpecificationsOneFileCommandMenu.png = ..\img\CompareOpenAPISpecificationsOneFileCommandMenu.png
23 | ..\img\CompareOpenAPISpecificationsTwoFilesCommandMenu.png = ..\img\CompareOpenAPISpecificationsTwoFilesCommandMenu.png
24 | ..\img\Csharp-Client-Generation-Exclude-Type-Names.png = ..\img\Csharp-Client-Generation-Exclude-Type-Names.png
25 | ..\img\Csharp-Client-Generation-OData.png = ..\img\Csharp-Client-Generation-OData.png
26 | ..\img\OpenWithNSwagCommandMenu.png = ..\img\OpenWithNSwagCommandMenu.png
27 | ..\img\Unchase-OpenAPI-Connected-Service-ReportBug.png = ..\img\Unchase-OpenAPI-Connected-Service-ReportBug.png
28 | ..\img\Unchase-OpenAPI-Swagger-Connected-Service-Customize.gif = ..\img\Unchase-OpenAPI-Swagger-Connected-Service-Customize.gif
29 | ..\img\Unchase-OpenAPI-Swagger-Connected-Service-Logo.png = ..\img\Unchase-OpenAPI-Swagger-Connected-Service-Logo.png
30 | ..\img\Unchase-OpenAPI-Swagger-Connected-Service-Settings-Meaning.png = ..\img\Unchase-OpenAPI-Swagger-Connected-Service-Settings-Meaning.png
31 | ..\img\Unchase-OpenAPI-Swagger-Connected-Service.gif = ..\img\Unchase-OpenAPI-Swagger-Connected-Service.gif
32 | ..\img\UnchaseOpenAPIConnectedServiceCommandsOptions1.png = ..\img\UnchaseOpenAPIConnectedServiceCommandsOptions1.png
33 | ..\img\UnchaseOpenAPIConnectedServiceCommandsOptions2.png = ..\img\UnchaseOpenAPIConnectedServiceCommandsOptions2.png
34 | EndProjectSection
35 | EndProject
36 | Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Unchase.OpenAPI.Connectedservice.Shared", "Unchase.OpenAPI.Connectedservice.Shared\Unchase.OpenAPI.Connectedservice.Shared.shproj", "{F9C2B492-3068-4F7D-9AA4-D4CD086C4468}"
37 | EndProject
38 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unchase.OpenAPI.Connectedservice.VS22", "Unchase.OpenAPI.Connectedservice.VS22\Unchase.OpenAPI.Connectedservice.VS22.csproj", "{CD7B2A0B-DF06-4B0D-BA4A-D996CAAAE8E9}"
39 | EndProject
40 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{9C6788D1-D100-4405-9736-D838FF304ADD}"
41 | EndProject
42 | Global
43 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
44 | Debug|Any CPU = Debug|Any CPU
45 | Debug|arm64 = Debug|arm64
46 | Debug|x86 = Debug|x86
47 | Release|Any CPU = Release|Any CPU
48 | Release|arm64 = Release|arm64
49 | Release|x86 = Release|x86
50 | EndGlobalSection
51 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
52 | {CFB451DE-8645-4125-8254-3C3BEB6C6CC7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
53 | {CFB451DE-8645-4125-8254-3C3BEB6C6CC7}.Debug|Any CPU.Build.0 = Debug|Any CPU
54 | {CFB451DE-8645-4125-8254-3C3BEB6C6CC7}.Debug|arm64.ActiveCfg = Debug|arm64
55 | {CFB451DE-8645-4125-8254-3C3BEB6C6CC7}.Debug|arm64.Build.0 = Debug|arm64
56 | {CFB451DE-8645-4125-8254-3C3BEB6C6CC7}.Debug|x86.ActiveCfg = Debug|Any CPU
57 | {CFB451DE-8645-4125-8254-3C3BEB6C6CC7}.Debug|x86.Build.0 = Debug|Any CPU
58 | {CFB451DE-8645-4125-8254-3C3BEB6C6CC7}.Release|Any CPU.ActiveCfg = Release|Any CPU
59 | {CFB451DE-8645-4125-8254-3C3BEB6C6CC7}.Release|Any CPU.Build.0 = Release|Any CPU
60 | {CFB451DE-8645-4125-8254-3C3BEB6C6CC7}.Release|arm64.ActiveCfg = Release|arm64
61 | {CFB451DE-8645-4125-8254-3C3BEB6C6CC7}.Release|arm64.Build.0 = Release|arm64
62 | {CFB451DE-8645-4125-8254-3C3BEB6C6CC7}.Release|x86.ActiveCfg = Release|Any CPU
63 | {CFB451DE-8645-4125-8254-3C3BEB6C6CC7}.Release|x86.Build.0 = Release|Any CPU
64 | {CD7B2A0B-DF06-4B0D-BA4A-D996CAAAE8E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
65 | {CD7B2A0B-DF06-4B0D-BA4A-D996CAAAE8E9}.Debug|Any CPU.Build.0 = Debug|Any CPU
66 | {CD7B2A0B-DF06-4B0D-BA4A-D996CAAAE8E9}.Debug|arm64.ActiveCfg = Debug|arm64
67 | {CD7B2A0B-DF06-4B0D-BA4A-D996CAAAE8E9}.Debug|arm64.Build.0 = Debug|arm64
68 | {CD7B2A0B-DF06-4B0D-BA4A-D996CAAAE8E9}.Debug|x86.ActiveCfg = Debug|x86
69 | {CD7B2A0B-DF06-4B0D-BA4A-D996CAAAE8E9}.Debug|x86.Build.0 = Debug|x86
70 | {CD7B2A0B-DF06-4B0D-BA4A-D996CAAAE8E9}.Release|Any CPU.ActiveCfg = Release|Any CPU
71 | {CD7B2A0B-DF06-4B0D-BA4A-D996CAAAE8E9}.Release|Any CPU.Build.0 = Release|Any CPU
72 | {CD7B2A0B-DF06-4B0D-BA4A-D996CAAAE8E9}.Release|arm64.ActiveCfg = Release|arm64
73 | {CD7B2A0B-DF06-4B0D-BA4A-D996CAAAE8E9}.Release|arm64.Build.0 = Release|arm64
74 | {CD7B2A0B-DF06-4B0D-BA4A-D996CAAAE8E9}.Release|x86.ActiveCfg = Release|x86
75 | {CD7B2A0B-DF06-4B0D-BA4A-D996CAAAE8E9}.Release|x86.Build.0 = Release|x86
76 | EndGlobalSection
77 | GlobalSection(SolutionProperties) = preSolution
78 | HideSolutionNode = FALSE
79 | EndGlobalSection
80 | GlobalSection(NestedProjects) = preSolution
81 | {CFB451DE-8645-4125-8254-3C3BEB6C6CC7} = {9C6788D1-D100-4405-9736-D838FF304ADD}
82 | {FEC756D6-3315-4914-B04F-B2CEA3F6A7F6} = {2E792B87-132B-4E5F-B542-86E96D18FAD8}
83 | {F9C2B492-3068-4F7D-9AA4-D4CD086C4468} = {9C6788D1-D100-4405-9736-D838FF304ADD}
84 | {CD7B2A0B-DF06-4B0D-BA4A-D996CAAAE8E9} = {9C6788D1-D100-4405-9736-D838FF304ADD}
85 | EndGlobalSection
86 | GlobalSection(ExtensibilityGlobals) = postSolution
87 | SolutionGuid = {B99E5F0C-212D-446A-AC93-89C7351C326D}
88 | EndGlobalSection
89 | GlobalSection(SharedMSBuildProjectFiles) = preSolution
90 | Unchase.OpenAPI.Connectedservice.Shared\Unchase.OpenAPI.Connectedservice.Shared.projitems*{cd7b2a0b-df06-4b0d-ba4a-d996caaae8e9}*SharedItemsImports = 4
91 | Unchase.OpenAPI.Connectedservice.Shared\Unchase.OpenAPI.Connectedservice.Shared.projitems*{cfb451de-8645-4125-8254-3c3beb6c6cc7}*SharedItemsImports = 4
92 | Unchase.OpenAPI.Connectedservice.Shared\Unchase.OpenAPI.Connectedservice.Shared.projitems*{f9c2b492-3068-4f7d-9aa4-d4cd086c4468}*SharedItemsImports = 13
93 | EndGlobalSection
94 | EndGlobal
95 |
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.Shared/CodeGeneration/BaseCodeGenDescriptor.cs:
--------------------------------------------------------------------------------
1 | //-----------------------------------------------------------------------
2 | //
3 | // Copyright (c) Nikolay Chebotov (Unchase). All rights reserved.
4 | //
5 | // https://github.com/unchase/Unchase.OpenAPI.Connectedservice/blob/master/LICENSE.md
6 | // Nickolay Chebotov (Unchase), spiritkola@hotmail.com
7 | //-----------------------------------------------------------------------
8 |
9 | using System;
10 | using System.IO;
11 | using System.Reflection;
12 | using System.Threading.Tasks;
13 |
14 | using EnvDTE;
15 | using Microsoft.VisualStudio.ComponentModelHost;
16 | using Microsoft.VisualStudio.ConnectedServices;
17 | using Microsoft.VisualStudio.Shell;
18 | using NuGet.VisualStudio;
19 | using Unchase.OpenAPI.ConnectedService.Common;
20 | using Task = System.Threading.Tasks.Task;
21 |
22 | namespace Unchase.OpenAPI.ConnectedService.CodeGeneration
23 | {
24 | internal abstract class BaseCodeGenDescriptor
25 | {
26 | #region Properties
27 |
28 | public IVsPackageInstaller PackageInstaller { get; private set; }
29 |
30 | public IVsPackageInstallerServices PackageInstallerServices { get; private set; }
31 |
32 | public ConnectedServiceHandlerContext Context { get; }
33 |
34 | public Project Project { get; private set; }
35 |
36 | public string ServiceUri { get; private set; }
37 |
38 | public Instance Instance { get; }
39 |
40 | #endregion
41 |
42 | #region Constructors
43 |
44 | protected BaseCodeGenDescriptor(ConnectedServiceHandlerContext context, Instance serviceInstance)
45 | {
46 | Instance = serviceInstance;
47 | Context = context;
48 | }
49 |
50 | protected virtual async Task InitializeAsync()
51 | {
52 | await InitNuGetInstallerAsync();
53 |
54 | await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
55 | Project = Context.ProjectHierarchy?.GetProject();
56 |
57 | var serviceConfig = Instance.ServiceConfig;
58 | if (serviceConfig.UseRelativePath)
59 | {
60 | var projectPath = Project?.Properties.Item("FullPath").Value.ToString();
61 | if (projectPath == null || !File.Exists(Path.Combine(projectPath, serviceConfig.Endpoint)))
62 | {
63 | throw new ArgumentException("Please input the service endpoint with exists file path.", "Service Endpoint");
64 | }
65 |
66 | ServiceUri = Path.Combine(projectPath, serviceConfig.Endpoint);
67 | }
68 | else
69 | {
70 | ServiceUri = serviceConfig.Endpoint;
71 | }
72 | }
73 |
74 | private async Task InitNuGetInstallerAsync()
75 | {
76 | var componentModel = await ServiceProvider.GetGlobalServiceAsync();
77 | //TODO: use new interfaces?
78 | PackageInstallerServices = componentModel.GetService();
79 | PackageInstaller = componentModel.GetService();
80 | }
81 |
82 | public static async Task CreateAsync(ConnectedServiceHandlerContext context, Instance serviceInstance) where T : BaseCodeGenDescriptor
83 | {
84 | var instance = (T)Activator.CreateInstance(typeof(T), BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.CreateInstance, null, new object[] { context, serviceInstance }, null, null);
85 | await instance.InitializeAsync();
86 | return instance;
87 | }
88 |
89 | #endregion
90 |
91 | #region Methods
92 |
93 | public abstract Task AddNugetPackagesAsync();
94 |
95 | public abstract Task AddGeneratedCodeAsync();
96 |
97 | public abstract Task AddGeneratedNSwagFileAsync();
98 |
99 | protected async Task GetReferenceFileFolderAsync()
100 | {
101 | var serviceReferenceFolderName = Context.HandlerHelper.GetServiceArtifactsRootFolder();
102 | await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
103 | return Project.GetServiceFolderPath(serviceReferenceFolderName, Instance.Name);
104 | }
105 |
106 | #endregion
107 | }
108 | }
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.Shared/Commands/OpenWithNSwagStudioCommand.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel.Design;
3 | using System.IO;
4 | using System.Windows;
5 |
6 | using EnvDTE;
7 | using EnvDTE80;
8 | using Microsoft.VisualStudio.Shell;
9 | using Microsoft.Win32;
10 | using Unchase.OpenAPI.ConnectedService.Common;
11 | using Task = System.Threading.Tasks.Task;
12 |
13 | namespace Unchase.OpenAPI.ConnectedService.Commands
14 | {
15 | ///
16 | /// Command handler.
17 | ///
18 | internal sealed class OpenWithNSwagStudioCommand
19 | {
20 | #region Properties and fields
21 |
22 | ///
23 | /// Command ID.
24 | ///
25 | public const int OpenInNSwagStudioCommandId = 0x0100;
26 |
27 | ///
28 | /// Command menu group (command set GUID).
29 | ///
30 | public static readonly Guid OpenInNSwagStudioCommandSet = new Guid("6914aba2-4e20-4f5b-8f5e-3485d4091437");
31 |
32 | ///
33 | /// Options.
34 | ///
35 | private readonly Options _options;
36 |
37 | ///
38 | /// VS Package that provides this command, not null.
39 | ///
40 | private readonly AsyncPackage _package;
41 |
42 | ///
43 | /// .
44 | ///
45 | private readonly DTE2 _dte;
46 |
47 | #endregion
48 |
49 | #region Constructors
50 |
51 | ///
52 | /// Initializes a new instance of the class.
53 | /// Adds our command handlers for menu (commands must exist in the command table file)
54 | ///
55 | /// Owner package, not null.
56 | /// Command service to add command to, not null.
57 | /// Options.
58 | /// .
59 | private OpenWithNSwagStudioCommand(
60 | AsyncPackage package,
61 | OleMenuCommandService commandService,
62 | Options options,
63 | DTE2 dte)
64 | {
65 | _options = options;
66 | _package = package ?? throw new ArgumentNullException(nameof(package));
67 | _dte = dte;
68 | commandService = commandService ?? throw new ArgumentNullException(nameof(commandService));
69 | var menuCommandId = new CommandID(OpenInNSwagStudioCommandSet, OpenInNSwagStudioCommandId);
70 | var menuItem = new OleMenuCommand(OpenFolderInVs, menuCommandId);
71 | menuItem.BeforeQueryStatus += BeforeQueryStatusCallback;
72 | commandService.AddCommand(menuItem);
73 | }
74 |
75 | #endregion
76 |
77 | #region Methods
78 |
79 | ///
80 | /// Gets the instance of the command.
81 | ///
82 | public static OpenWithNSwagStudioCommand Instance { get; private set; }
83 |
84 | ///
85 | /// Gets the service provider from the owner package.
86 | ///
87 | private IAsyncServiceProvider ServiceProvider => _package;
88 |
89 | ///
90 | /// Initializes the singleton instance of the command.
91 | ///
92 | /// Owner package, not null.
93 | /// Options.
94 | public static async Task InitializeAsync(AsyncPackage package, Options options)
95 | {
96 | // Switch to the main thread - the call to AddCommand in OpenWithNSwagStudioCommand's constructor requires
97 | // the UI thread.
98 | await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(package.DisposalToken);
99 | var commandService = await package.GetServiceAsync(typeof(IMenuCommandService)) as OleMenuCommandService;
100 | var dte = await package.GetServiceAsync(typeof(DTE)) as DTE2;
101 | Instance = new OpenWithNSwagStudioCommand(package, commandService, options, dte);
102 | }
103 |
104 | ///
105 | /// This function is the callback used for .
106 | ///
107 | /// Event sender.
108 | /// Event args.
109 | private void BeforeQueryStatusCallback(object sender, EventArgs e)
110 | {
111 | ThreadHelper.JoinableTaskFactory.Run(async () =>
112 | {
113 | await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(_package.DisposalToken);
114 | var cmd = (OleMenuCommand)sender;
115 | var path = ProjectHelper.GetSelectedPath(_dte);
116 | cmd.Visible = !string.IsNullOrWhiteSpace(path) && !Directory.Exists(path.Trim('"')) && (path.Trim('"').EndsWith(".nswag") || path.Trim('"').EndsWith(".nswag.json"));
117 | cmd.Enabled = cmd.Visible;
118 | });
119 | }
120 |
121 | ///
122 | /// This function is the callback used to execute the command when the menu item is clicked.
123 | /// See the constructor to see how the menu item is associated with this function using
124 | /// OleMenuCommandService service and MenuCommand class.
125 | ///
126 | /// Event sender.
127 | /// Event args.
128 | private void OpenFolderInVs(object sender, EventArgs e)
129 | {
130 | ThreadHelper.ThrowIfNotOnUIThread();
131 | try
132 | {
133 | var path = ProjectHelper.GetSelectedPath(_dte);
134 | if (!string.IsNullOrEmpty(path))
135 | {
136 | OpenNSwagStudio(path);
137 | }
138 | else
139 | {
140 | MessageBox.Show("Couldn't resolve the file path.", Constants.ExtensionName, MessageBoxButton.OK, MessageBoxImage.Warning);
141 | }
142 | }
143 | catch (Exception ex)
144 | {
145 | LoggerHelper.Log(ex);
146 | }
147 | }
148 |
149 | ///
150 | /// Open file with in NSwagStudio.
151 | ///
152 | ///
153 | private void OpenNSwagStudio(string path)
154 | {
155 | EnsureNSwagStudioPathExist();
156 | var isDirectory = Directory.Exists(path.Trim('"'));
157 | if (isDirectory)
158 | {
159 | return;
160 | }
161 |
162 | var fileInfo = new FileInfo(path.Trim('"'));
163 | if (!fileInfo.Extension.Equals(".nswag") && !fileInfo.Extension.Equals(".json"))
164 | {
165 | MessageBox.Show("Only files with extensions of \".nswag\" or \".json\" can be openned by NSwagStudio.",
166 | Constants.ExtensionName, MessageBoxButton.OK, MessageBoxImage.Warning);
167 | return;
168 | }
169 |
170 | var args = $"{path}";
171 |
172 | var start = new System.Diagnostics.ProcessStartInfo
173 | {
174 | FileName = $"\"{_options.PathToNSwagStudioExe}\"",
175 | Arguments = args,
176 | CreateNoWindow = true,
177 | UseShellExecute = false,
178 | WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden,
179 | };
180 |
181 | using (System.Diagnostics.Process.Start(start))
182 | {
183 | }
184 | }
185 |
186 | ///
187 | /// Ensure that NSwagStudio path is exists.
188 | ///
189 | private void EnsureNSwagStudioPathExist()
190 | {
191 | if (File.Exists(_options.PathToNSwagStudioExe))
192 | {
193 | return;
194 | }
195 |
196 | var box = MessageBox.Show("Can't find NSwagStudio (NSwagStudio.exe). Would you like to help me find it?", Constants.ExtensionName, MessageBoxButton.YesNo, MessageBoxImage.Question);
197 |
198 | if (box == MessageBoxResult.No)
199 | {
200 | return;
201 | }
202 |
203 | var dialog = new OpenFileDialog
204 | {
205 | DefaultExt = ".exe",
206 | FileName = "NSwagStudio.exe",
207 | InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles),
208 | CheckFileExists = true
209 | };
210 |
211 | var result = dialog.ShowDialog();
212 |
213 | if (result == true)
214 | {
215 | _options.PathToNSwagStudioExe = dialog.FileName;
216 | _options.SaveSettingsToStorage();
217 | }
218 | }
219 |
220 | #endregion
221 | }
222 | }
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.Shared/Commands/OpenWithNSwagStudioCommandPackage.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using System.Threading;
4 |
5 | using Microsoft.VisualStudio.Shell;
6 | using Unchase.OpenAPI.ConnectedService.Common;
7 | using Task = System.Threading.Tasks.Task;
8 |
9 | namespace Unchase.OpenAPI.ConnectedService.Commands
10 | {
11 | ///
12 | /// This is the class that implements the package exposed by this assembly.
13 | ///
14 | ///
15 | ///
16 | /// The minimum requirement for a class to be considered a valid package for Visual Studio
17 | /// is to implement the IVsPackage interface and register itself with the shell.
18 | /// This package uses the helper classes defined inside the Managed Package Framework (MPF)
19 | /// to do it: it derives from the Package class that provides the implementation of the
20 | /// IVsPackage interface and uses the registration attributes defined in the framework to
21 | /// register itself and its components with the shell. These attributes tell the pkgdef creation
22 | /// utility what data to put into .pkgdef file.
23 | ///
24 | ///
25 | /// To get loaded into VS, the package must be referred by <Asset Type="Microsoft.VisualStudio.VsPackage" ...> in .vsixmanifest file.
26 | ///
27 | ///
28 | [PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)]
29 | [InstalledProductRegistration("#110", "#112", Constants.ExtensionName, IconResourceID = 400)] // Info on this package for Help/About
30 | [ProvideMenuResource("Menus.ctmenu", 1)]
31 | [ProvideOptionPage(typeof(Options), "Web", Constants.ExtensionName, 101, 102, true, new string[0], ProvidesLocalizedCategoryName = false)]
32 | [Guid(OpenWithNSwagStudioCommandPackage.PackageGuidString)]
33 | [ProvideAutoLoad(OpenWithNSwagStudioCommandPackage.UINswagStudioFilesContextGuid, PackageAutoLoadFlags.BackgroundLoad)]
34 | [ProvideUIContextRule(OpenWithNSwagStudioCommandPackage.UINswagStudioFilesContextGuid,
35 | name: "Open only .nswag (.nswag.json) files",
36 | expression: "DotNSwag | DotNSwagDotJson",
37 | termNames: new[] { "DotNSwag", "DotNSwagDotJson" },
38 | termValues: new[] { "HierSingleSelectionName:.nswag$", "HierSingleSelectionName:.nswag.json$" })]
39 | [ProvideAutoLoad(OpenWithNSwagStudioCommandPackage.UINSwagJsonFilesContextGuid, PackageAutoLoadFlags.BackgroundLoad)]
40 | [ProvideUIContextRule(OpenWithNSwagStudioCommandPackage.UINSwagJsonFilesContextGuid,
41 | name: "Open only (.nswag.json) files",
42 | expression: "DotNSwagDotJson",
43 | termNames: new[] { "DotNSwagDotJson" },
44 | termValues: new[] { "HierSingleSelectionName:.nswag.json$" })]
45 | //[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", Justification = "pkgdef, VS and vsixmanifest are valid VS terms")]
46 | public sealed class OpenWithNSwagStudioCommandPackage : AsyncPackage
47 | {
48 | ///
49 | /// OpenWithNSwagStudioCommandPackage GUID string.
50 | ///
51 | public const string PackageGuidString = "af9e0cad-f39d-4c39-8f02-55bd034b3b6c";
52 |
53 | public const string UINswagStudioFilesContextGuid = "BE1DF41C-5528-4C30-A802-025A3095069E";
54 |
55 | public const string UINSwagJsonFilesContextGuid = "CD745E30-C8A7-4DDC-8CAF-62179AF39222";
56 |
57 | ///
58 | /// Initializes a new instance of the class.
59 | ///
60 | public OpenWithNSwagStudioCommandPackage()
61 | {
62 | // Inside this method you can place any initialization code that does not require
63 | // any Visual Studio service because at this point the package object is created but
64 | // not sited yet inside Visual Studio environment. The place to do all the other
65 | // initialization is the Initialize method.
66 | }
67 |
68 | #region Package Members
69 |
70 | ///
71 | /// Initialization of the package; this method is called right after the package is sited, so this is the place
72 | /// where you can put all the initialization code that rely on services provided by VisualStudio.
73 | ///
74 | /// A cancellation token to monitor for initialization cancellation, which can occur when VS is shutting down.
75 | /// A provider for progress updates.
76 | /// A task representing the async work of package initialization, or an already completed task if there is none. Do not return null from this method.
77 | protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress progress)
78 | {
79 | // When initialized asynchronously, the current thread may be a background thread at this point.
80 | // Do any initialization that requires the UI thread after switching to the UI thread.
81 | await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);
82 |
83 | var options = (Options)GetDialogPage(typeof(Options));
84 | await LoggerHelper.InitializeAsync(this, Constants.ExtensionName);
85 |
86 | await OpenWithNSwagStudioCommand.InitializeAsync(this, options);
87 | await DiffSpecificationsCommand.InitializeAsync(this, options);
88 | }
89 |
90 | #endregion
91 | }
92 | }
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.Shared/Commands/OpenWithNSwagStudioCommandPackage.vsct:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
13 |
14 |
15 |
16 |
24 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.Shared/Commands/Resources/OpenWithNSwagStudioCommand.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unchase/Unchase.OpenAPI.Connectedservice/125976bb4c05817d8afe2d0f47b0c2f8a3b714f5/src/Unchase.OpenAPI.Connectedservice.Shared/Commands/Resources/OpenWithNSwagStudioCommand.png
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.Shared/Commands/Resources/OpenWithNSwagStudioCommandPackage.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unchase/Unchase.OpenAPI.Connectedservice/125976bb4c05817d8afe2d0f47b0c2f8a3b714f5/src/Unchase.OpenAPI.Connectedservice.Shared/Commands/Resources/OpenWithNSwagStudioCommandPackage.ico
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.Shared/Commands/VSPackage.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | Web
122 |
123 |
124 | Unchase OpenAPI (Swagger) Connected Service
125 |
126 |
127 | Open in NSwagStudio
128 |
129 |
130 | Adds a menu command that lets you open nswag file in NSwagStudio.
131 |
132 |
133 |
134 | Resources\OpenWithNSwagStudioCommandPackage.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
135 |
136 |
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.Shared/Common/Commands/StackPanelChangeVisibilityCommand.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Controls;
3 | using System.Windows.Input;
4 |
5 | namespace Unchase.OpenAPI.ConnectedService.Common.Commands
6 | {
7 | class StackPanelChangeVisibilityCommand :
8 | ICommand
9 | {
10 |
11 | bool ICommand.CanExecute(object parameter)
12 | {
13 | return true;
14 | }
15 |
16 | void ICommand.Execute(object parameter)
17 | {
18 | (parameter as StackPanel)?.ChangeStackPanelVisibility();
19 | }
20 |
21 | event EventHandler ICommand.CanExecuteChanged { add { } remove { } }
22 | }
23 | }
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.Shared/Common/ExtensionsHelper.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 | using System.Windows.Controls;
3 |
4 | namespace Unchase.OpenAPI.ConnectedService.Common
5 | {
6 | internal static class ExtensionsHelper
7 | {
8 | internal static void ChangeStackPanelVisibility(this StackPanel stackPanel)
9 | {
10 | if (stackPanel.Visibility == Visibility.Collapsed)
11 | {
12 | stackPanel.Visibility = Visibility.Visible;
13 | }
14 | else if (stackPanel.Visibility == Visibility.Visible)
15 | {
16 | stackPanel.Visibility = Visibility.Collapsed;
17 | }
18 | }
19 |
20 | internal static bool TryDowncastToFEorFCE(this DependencyObject d, out FrameworkElement fe, out FrameworkContentElement fce)
21 | {
22 | fe = null;
23 | fce = null;
24 | if (d is FrameworkElement fe2)
25 | {
26 | fe = fe2;
27 | return true;
28 | }
29 | else if (d is FrameworkContentElement fce2)
30 | {
31 | fce = fce2;
32 | return true;
33 | }
34 | return false;
35 | }
36 | }
37 | }
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.Shared/Common/LoggerHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Concurrent;
3 |
4 | using Microsoft.VisualStudio.Shell;
5 | using Microsoft.VisualStudio.Shell.Interop;
6 | using Task = System.Threading.Tasks.Task;
7 |
8 | namespace Unchase.OpenAPI.ConnectedService.Common
9 | {
10 | public static class LoggerHelper
11 | {
12 | private static IVsOutputWindowPane _pane;
13 |
14 | private static IVsOutputWindow _outputService;
15 |
16 | private static string _name;
17 |
18 | private static Lazy> _msgQueue = new Lazy>(() => new ConcurrentQueue());
19 |
20 | public static async Task InitializeAsync(AsyncPackage package, string name)
21 | {
22 | await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(package.DisposalToken);
23 | _outputService = await package.GetServiceAsync(typeof(SVsOutputWindow)) as IVsOutputWindow;
24 | _name = name;
25 | }
26 |
27 | public static async Task LogAsync(string message)
28 | {
29 | if (string.IsNullOrEmpty(message))
30 | {
31 | return;
32 | }
33 | await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
34 | try
35 | {
36 | string outputmsg = DateTime.Now + ": " + message + Environment.NewLine;
37 | if (EnsurePane())
38 | {
39 | if (_msgQueue != null && _msgQueue.IsValueCreated)
40 | {
41 | while (_msgQueue.Value.TryDequeue(out var savedmsg))
42 | _pane.OutputString(savedmsg);
43 | _msgQueue = null;
44 | }
45 | _pane.OutputString(outputmsg);
46 | }
47 | else
48 | {
49 | // Save the messages until the service is retrieved and pane is created.
50 | _msgQueue.Value.Enqueue(outputmsg);
51 | }
52 | }
53 | catch (Exception ex)
54 | {
55 | System.Diagnostics.Debug.WriteLine(ex);
56 | }
57 | }
58 |
59 | private static readonly string _faultEventName = $"{Constants.ProviderId.Replace('.', '/')}/{nameof(LoggerHelper)}/Log";
60 | public static void Log(string message)
61 | {
62 | // Need to use a separate async method here to work around a analyzer bug, see here:
63 | //https://github.com/microsoft/vs-threading/issues/993
64 | ThreadHelper.JoinableTaskFactory.RunAsync(() => LogAsync(message)).FileAndForget(_faultEventName);
65 | }
66 |
67 | public static void Log(Exception ex)
68 | {
69 | if (ex != null)
70 | {
71 | Log(ex.ToString());
72 | }
73 | }
74 |
75 | private static bool EnsurePane()
76 | {
77 | ThreadHelper.ThrowIfNotOnUIThread();
78 | if (_pane == null)
79 | {
80 | var guid = Guid.NewGuid();
81 | // Thread-safe here, because it is ensured above that the thread which sets this field
82 | // is always the same which executes this method, only the sequence may be different.
83 | _outputService?.CreatePane(ref guid, _name, 1, 1);
84 | _outputService?.GetPane(ref guid, out _pane);
85 | }
86 |
87 | return _pane != null;
88 | }
89 | }
90 | }
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.Shared/Common/ProjectHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using EnvDTE;
5 | using EnvDTE80;
6 | using Microsoft.VisualStudio;
7 | using Microsoft.VisualStudio.Shell.Interop;
8 | using Newtonsoft.Json.Linq;
9 |
10 | namespace Unchase.OpenAPI.ConnectedService.Common
11 | {
12 | ///
13 | /// A utility class for working with Visual Studio project system.
14 | ///
15 | internal static class ProjectHelper
16 | {
17 | public const int VshpropIdVshpropIdExtObject = -2027;
18 |
19 | public static Project GetProject(this IVsHierarchy projectHierarchy)
20 | {
21 | Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();
22 | var result = projectHierarchy.GetProperty(
23 | VSConstants.VSITEMID_ROOT,
24 | VshpropIdVshpropIdExtObject, //(int)__VSHPROPID.VSHPROPID_ExtObject,
25 | out object projectObject);
26 | ErrorHandler.ThrowOnFailure(result);
27 | return (Project)projectObject;
28 | }
29 |
30 | public static string GetNameSpace(this Project project)
31 | {
32 | Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();
33 | return project?.Properties?.Item("DefaultNamespace")?.Value.ToString();
34 | }
35 |
36 | public static string GetServiceFolderPath(this Project project, string rootFolder, string serviceName)
37 | {
38 | Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();
39 | var servicePath = project?.ProjectItems?
40 | .Item(rootFolder).ProjectItems
41 | .Item(serviceName).Properties
42 | .Item("FullPath").Value.ToString() ?? project?.Properties.Item("FullPath").Value.ToString();
43 |
44 | return servicePath;
45 | }
46 |
47 | public static string GetSelectedPath(DTE2 dte)
48 | {
49 | Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();
50 | var items = (Array)dte.ToolWindows.SolutionExplorer?.SelectedItems;
51 | if (items == null)
52 | {
53 | return null;
54 | }
55 |
56 | var files = new List();
57 |
58 | foreach (UIHierarchyItem selItem in items)
59 | {
60 | if (selItem?.Object is ProjectItem item)
61 | {
62 | files.Add(item.GetFilePath());
63 | }
64 | }
65 |
66 | return files.Count > 0
67 | ? string.Join(" ", files)
68 | : null;
69 | }
70 |
71 | public static string GetFilePath(this ProjectItem item)
72 | {
73 | return $"\"{item?.FileNames[1]}\""; // Indexing starts from 1
74 | }
75 |
76 | internal static bool IsJson(string input)
77 | {
78 | input = input.Trim();
79 | JToken.Parse(input);
80 | return input.StartsWith("{") && input.EndsWith("}")
81 | || input.StartsWith("[") && input.EndsWith("]");
82 | }
83 | }
84 | }
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.Shared/Common/UserSettingsPersistenceHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.IO.IsolatedStorage;
4 | using System.Runtime.Serialization;
5 | using System.Threading.Tasks;
6 | using System.Xml;
7 |
8 | using Microsoft.VisualStudio.ConnectedServices;
9 |
10 | namespace Unchase.OpenAPI.ConnectedService.Common
11 | {
12 | internal static class UserSettingsPersistenceHelper
13 | {
14 | #region Public methods
15 |
16 | ///
17 | /// Saves user settings to isolated storage. The data is stored with the user's roaming profile.
18 | ///
19 | ///
20 | /// Non-critical exceptions are handled by writing an error message in the output window.
21 | ///
22 | public static async Task SaveAsync(
23 | object userSettings,
24 | string providerId,
25 | string name,
26 | Action onSaved,
27 | ConnectedServiceLogger logger)
28 | {
29 | var fileName = GetStorageFileName(providerId, name);
30 |
31 | await ExecuteNoncriticalOperationAsync(
32 | async () =>
33 | {
34 | using (var file = GetIsolatedStorageFile())
35 | {
36 | IsolatedStorageFileStream stream = null;
37 | try
38 | {
39 | // note: this overwrites existing settings file if it exists
40 | stream = file.OpenFile(fileName, FileMode.Create);
41 | using (var writer = XmlWriter.Create(stream, new XmlWriterSettings { Async = true }))
42 | {
43 | stream = null;
44 |
45 | //TODO: use async serializer
46 | Type[] knownTypes = new[]
47 | {
48 | typeof(Microsoft.OpenApi.OData.Extensions.ODataRoutePathPrefixProvider)
49 | };
50 | var dcs = new DataContractSerializer(userSettings.GetType(), knownTypes);
51 | dcs.WriteObject(writer, userSettings);
52 |
53 | await writer.FlushAsync();
54 | }
55 | }
56 | finally
57 | {
58 | stream?.Dispose();
59 | }
60 | }
61 |
62 | onSaved?.Invoke();
63 | },
64 | logger,
65 | "Failed loading the {0} user settings",
66 | fileName);
67 | }
68 |
69 | ///
70 | /// Loads user settings from isolated storage.
71 | ///
72 | ///
73 | /// Non-critical exceptions are handled by writing an error message in the output window and
74 | /// returning null.
75 | ///
76 | public static async Task LoadAsync(
77 | string providerId,
78 | string name,
79 | Action onLoaded,
80 | ConnectedServiceLogger logger)
81 | where T : class
82 | {
83 | var fileName = GetStorageFileName(providerId, name);
84 | T result = null;
85 |
86 | await ExecuteNoncriticalOperationAsync(
87 | async () =>
88 | {
89 | using (var file = GetIsolatedStorageFile())
90 | {
91 | if (file.FileExists(fileName))
92 | {
93 | IsolatedStorageFileStream stream = null;
94 | try
95 | {
96 | stream = file.OpenFile(fileName, FileMode.Open);
97 | var settings = new XmlReaderSettings
98 | {
99 | Async = true,
100 | XmlResolver = null
101 | };
102 |
103 | using (var reader = XmlReader.Create(stream, settings))
104 | {
105 | stream = null;
106 |
107 | //TODO: use async serializer
108 | Type[] knownTypes = new[]
109 | {
110 | typeof(Microsoft.OpenApi.OData.Extensions.ODataRoutePathPrefixProvider)
111 | };
112 | var dcs = new DataContractSerializer(typeof(T), knownTypes);
113 | result = dcs.ReadObject(reader) as T;
114 | }
115 | }
116 | finally
117 | {
118 | stream?.Dispose();
119 | }
120 |
121 | if (onLoaded != null && result != null)
122 | {
123 | onLoaded(result);
124 | }
125 | }
126 | }
127 | },
128 | logger,
129 | "Failed loading the {0} user settings",
130 | fileName);
131 |
132 | return result;
133 | }
134 |
135 | #endregion
136 |
137 | #region Private methods
138 |
139 | private static string GetStorageFileName(string providerId, string name)
140 | {
141 | return providerId + "_" + name + ".xml";
142 | }
143 |
144 | private static IsolatedStorageFile GetIsolatedStorageFile()
145 | {
146 | return IsolatedStorageFile.GetStore(
147 | IsolatedStorageScope.Assembly | IsolatedStorageScope.User | IsolatedStorageScope.Roaming, null, null);
148 | }
149 |
150 | private static async Task ExecuteNoncriticalOperationAsync(
151 | Func operation,
152 | ConnectedServiceLogger logger,
153 | string failureMessage,
154 | string failureMessageArg)
155 | {
156 | try
157 | {
158 | await operation();
159 | }
160 | catch (Exception ex)
161 | {
162 | await logger.WriteMessageAsync(LoggerMessageCategory.Warning, failureMessage, failureMessageArg, ex);
163 | }
164 | }
165 |
166 | #endregion
167 | }
168 | }
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.Shared/Constants.cs:
--------------------------------------------------------------------------------
1 | namespace Unchase.OpenAPI.ConnectedService
2 | {
3 | public static class Constants
4 | {
5 | public static class Vsix
6 | {
7 | public const string Version = "1.9.1";
8 | }
9 |
10 | public const string Author = "Nikolay Chebotov (Unchase)";
11 | public const string ExtensionCategory = "OpenAPI";
12 | public const string ExtensionName = "Unchase OpenAPI (Swagger) Connected Service";
13 | public const string ExtensionDescription = "Generates C# HttpClient code for OpenAPI (Swagger API) web service with NSwag.";
14 | public const string ProviderId = "Unchase.OpenAPI.ConnectedService";
15 | public const string Website = "https://github.com/unchase/Unchase.OpenAPI.Connectedservice/";
16 | public const string Copyright = "Copyright © 2021-2023";
17 |
18 | public const string NuGetOnlineRepository = "https://www.nuget.org/api/v2/";
19 | public const string DefaultServiceName = "OpenAPIService";
20 | public const string DefaultGeneratedFileName = "OpenAPI";
21 |
22 | public const string NewtonsoftJsonNuGetPackage = "Newtonsoft.Json";
23 | public const string NewtonsoftJsonAssemblyName = "Newtonsoft.Json";
24 | public const string SystemNetHttpNuGetPackage = "System.Net.Http";
25 | public const string SystemComponentModelAnnotationsNuGetPackage = "System.ComponentModel.Annotations";
26 | public const string PortableDataAnnotationsNuGetPackage = "Portable.DataAnnotations";
27 | public const string MicrosoftAspNetCoreMvcNuGetPackage = "Microsoft.AspNetCore.Mvc";
28 | public const string MicrosoftExtensionsFileProvidersAbstractionsAssemblyName = "Microsoft.Extensions.FileProviders.Abstractions";
29 | public const string SystemRuntimeCompilerServicesUnsafeAssemblyName = "System.Runtime.CompilerServices.Unsafe";
30 |
31 | public const string OpenApiConvertSettingsPathPrefix = "OData";
32 |
33 | public static string[] NetStandardNuGetPackages = {
34 | NewtonsoftJsonNuGetPackage,
35 | SystemNetHttpNuGetPackage,
36 | SystemComponentModelAnnotationsNuGetPackage
37 | };
38 |
39 | public static string[] FullNetNuGetPackages = {
40 | NewtonsoftJsonNuGetPackage
41 | };
42 |
43 | public static string[] PortableClassLibraryNuGetPackages = {
44 | NewtonsoftJsonNuGetPackage,
45 | SystemNetHttpNuGetPackage,
46 | PortableDataAnnotationsNuGetPackage
47 | };
48 |
49 | public static string[] ControllerNuGetPackages =
50 | {
51 | MicrosoftAspNetCoreMvcNuGetPackage
52 | };
53 |
54 | public static string[] NetStandardUnsupportedVersions =
55 | {
56 | "Version=v1.0",
57 | "Version=v1.1",
58 | "Version=v1.2",
59 | "Version=v1.3"
60 | };
61 | }
62 | }
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.Shared/Converters/EqualityConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 | using System.Linq;
4 | using System.Windows;
5 | using System.Windows.Data;
6 |
7 | namespace Unchase.OpenAPI.ConnectedService.Converters
8 | {
9 | public class EqualityConverter :
10 | IValueConverter
11 | {
12 | public object Convert(
13 | object valueObject,
14 | Type targetType,
15 | object parameterObject,
16 | CultureInfo culture)
17 | {
18 | var str1 = parameterObject != null
19 | ? parameterObject.ToString()
20 | : string.Empty;
21 | var str2 = valueObject != null
22 | ? valueObject.ToString()
23 | : string.Empty;
24 |
25 | bool flag;
26 | if (str1.StartsWith("!"))
27 | {
28 | flag = str1.Substring(1) != str2;
29 | }
30 | else
31 | {
32 | flag = str1.Split(',').Contains(str2);
33 | }
34 |
35 | if (targetType == typeof(Visibility))
36 | {
37 | return (Visibility)(flag ? 0 : 2);
38 | }
39 |
40 | return flag;
41 | }
42 |
43 | public object ConvertBack(
44 | object value,
45 | Type targetType,
46 | object parameter,
47 | CultureInfo culture)
48 | {
49 | throw new NotSupportedException();
50 | }
51 | }
52 | }
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.Shared/Converters/NotConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 | using System.Windows;
4 | using System.Windows.Data;
5 |
6 | namespace Unchase.OpenAPI.ConnectedService.Converters
7 | {
8 | public class NotConverter :
9 | IValueConverter
10 | {
11 | public object Convert(
12 | object value,
13 | Type targetType,
14 | object parameter,
15 | CultureInfo culture)
16 | {
17 | if (targetType == typeof(Visibility))
18 | {
19 | return (Visibility)((Visibility)new VisibilityConverter().Convert(value, targetType, parameter, culture) == Visibility.Visible ? 2 : 0);
20 | }
21 |
22 | if (!(targetType == typeof(bool)))
23 | {
24 | return null;
25 | }
26 |
27 | if (value == null)
28 | {
29 | return true;
30 | }
31 |
32 | return !(bool)value;
33 | }
34 |
35 | public object ConvertBack(
36 | object value,
37 | Type targetType,
38 | object parameter,
39 | CultureInfo culture)
40 | {
41 | if (value is bool && targetType == typeof(bool))
42 | return !(bool)value;
43 | throw new NotImplementedException();
44 | }
45 | }
46 | }
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.Shared/Converters/NotNullOrWhiteSpaceConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 | using System.Windows.Data;
4 |
5 | namespace Unchase.OpenAPI.ConnectedService.Converters
6 | {
7 | class NotNullOrWhiteSpaceConverter :
8 | IValueConverter
9 | {
10 | public object Convert(
11 | object value,
12 | Type targetType,
13 | object parameter,
14 | CultureInfo culture)
15 | {
16 | if (targetType == typeof(string))
17 | {
18 | if (string.IsNullOrWhiteSpace(value as string) && parameter is string defaultValue)
19 | {
20 | return defaultValue;
21 | }
22 |
23 | return value;
24 | }
25 |
26 | throw new NotImplementedException();
27 | }
28 |
29 | public object ConvertBack(
30 | object value,
31 | Type targetType,
32 | object parameter,
33 | CultureInfo culture)
34 | {
35 | if (targetType == typeof(string))
36 | {
37 | if (string.IsNullOrWhiteSpace(value as string) && parameter is string defaultValue)
38 | {
39 | return defaultValue;
40 | }
41 |
42 | return value;
43 | }
44 |
45 | throw new NotImplementedException();
46 | }
47 | }
48 | }
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.Shared/Converters/StringArrayConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 | using System.Linq;
4 | using System.Windows.Data;
5 |
6 | namespace Unchase.OpenAPI.ConnectedService.Converters
7 | {
8 | public class StringArrayConverter :
9 | IValueConverter
10 | {
11 | public object Convert(
12 | object value,
13 | Type targetType,
14 | object parameter,
15 | CultureInfo culture)
16 | {
17 | var separator = "\n";
18 | if (parameter != null)
19 | {
20 | separator = (string)parameter;
21 | }
22 |
23 | return value != null
24 | ? string.Join(separator, (string[])value)
25 | : string.Empty;
26 | }
27 |
28 | public object ConvertBack(
29 | object value,
30 | Type targetType,
31 | object parameter,
32 | CultureInfo culture)
33 | {
34 | var separator = '\n';
35 | if (parameter != null)
36 | {
37 | separator = System.Convert.ToChar(parameter);
38 | }
39 |
40 | return value?.ToString()
41 | .Trim('\r')
42 | .Split(separator)
43 | .Select(s => s.Trim())
44 | .Where(n => !string.IsNullOrEmpty(n))
45 | .ToArray() ?? new string[] { };
46 | }
47 | }
48 | }
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.Shared/Converters/VisibilityConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Globalization;
4 | using System.Windows;
5 | using System.Windows.Data;
6 |
7 | namespace Unchase.OpenAPI.ConnectedService.Converters
8 | {
9 | public class VisibilityConverter :
10 | IValueConverter
11 | {
12 | public object Convert(
13 | object value,
14 | Type targetType,
15 | object parameter,
16 | CultureInfo culture)
17 | {
18 | var flag = value != null;
19 |
20 | if (value is bool b)
21 | {
22 | flag = b;
23 | }
24 |
25 | if (value is string s)
26 | {
27 | flag = !string.IsNullOrEmpty(s);
28 | }
29 |
30 | if (value is IList list)
31 | {
32 | if (list.Count == 0)
33 | {
34 | flag = false;
35 | }
36 | else
37 | {
38 | if (parameter is string)
39 | {
40 | var str = parameter.ToString();
41 | if (str.StartsWith("CheckAll:"))
42 | {
43 | var name = str.Substring(9);
44 | foreach (var obj in list)
45 | {
46 | var property = obj.GetType().GetProperty(name);
47 | if (property != null && !(bool)Convert(property.GetValue(obj, null), typeof(bool), null, null))
48 | {
49 | flag = false;
50 | break;
51 | }
52 | }
53 | }
54 | }
55 | }
56 | }
57 |
58 | if (value is int i)
59 | {
60 | flag = i > 0;
61 | }
62 |
63 | if (value is Visibility visibility)
64 | {
65 | flag = visibility == Visibility.Visible;
66 | }
67 |
68 | if (targetType == typeof(Visibility))
69 | {
70 | return (Visibility)(flag ? 0 : 2);
71 | }
72 |
73 | return flag;
74 | }
75 |
76 | public object ConvertBack(
77 | object value,
78 | Type targetType,
79 | object parameter,
80 | CultureInfo culture)
81 | {
82 | throw new NotSupportedException();
83 | }
84 | }
85 | }
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.Shared/Converters/VisibilityToHyperlinkTextConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 | using System.Windows;
4 | using System.Windows.Data;
5 |
6 | namespace Unchase.OpenAPI.ConnectedService.Converters
7 | {
8 | class VisibilityToHyperlinkTextConverter :
9 | IValueConverter
10 | {
11 | public object Convert(
12 | object value,
13 | Type targetType,
14 | object parameter,
15 | CultureInfo culture)
16 | {
17 | if (value is Visibility visibility)
18 | {
19 | switch (visibility)
20 | {
21 | case Visibility.Visible:
22 | {
23 | return "Hide";
24 | }
25 |
26 | default:
27 | return "Show";
28 | }
29 | }
30 |
31 | return "Show";
32 | }
33 |
34 | public object ConvertBack(
35 | object value,
36 | Type targetType,
37 | object parameter,
38 | CultureInfo culture)
39 | {
40 | throw new NotSupportedException();
41 | }
42 | }
43 | }
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.Shared/Handler.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading;
3 | using System.Threading.Tasks;
4 |
5 | using Microsoft.VisualStudio.ConnectedServices;
6 | using Unchase.OpenAPI.ConnectedService.CodeGeneration;
7 |
8 | namespace Unchase.OpenAPI.ConnectedService
9 | {
10 | [ConnectedServiceHandlerExport(Constants.ProviderId, AppliesTo = "VB | CSharp | Web")]
11 | internal class Handler :
12 | ConnectedServiceHandler
13 | {
14 | #region Methods
15 |
16 | public override async Task AddServiceInstanceAsync(
17 | ConnectedServiceHandlerContext context,
18 | CancellationToken cancellationToken)
19 | {
20 | var instance = (Instance)context.ServiceInstance;
21 | await context.Logger.WriteMessageAsync(LoggerMessageCategory.Information, $"Adding service instance for \"{instance.ServiceConfig.Endpoint}\"...");
22 |
23 | // await context.Logger.WriteMessageAsync(LoggerMessageCategory.Information, "Checking prerequisites...");
24 | // await CheckingPrerequisitesAsync(context, instance);
25 |
26 | var codeGenDescriptor = await GenerateCodeAsync(context, instance);
27 | context.SetExtendedDesignerData(instance.ServiceConfig);
28 | await context.Logger.WriteMessageAsync(LoggerMessageCategory.Information, "Adding service instance complete!");
29 | return new AddServiceInstanceResult(context.ServiceInstance.Name, new Uri(Constants.Website));
30 | }
31 |
32 | public override async Task UpdateServiceInstanceAsync(
33 | ConnectedServiceHandlerContext context,
34 | CancellationToken cancellationToken)
35 | {
36 | var instance = (Instance)context.ServiceInstance;
37 | await context.Logger.WriteMessageAsync(LoggerMessageCategory.Information, $"Re-adding service instance for \"{instance.ServiceConfig.Endpoint}\"...");
38 |
39 | // await context.Logger.WriteMessageAsync(LoggerMessageCategory.Information, "Checking prerequisites...");
40 | // await CheckingPrerequisitesAsync(context, instance);
41 |
42 | var codeGenDescriptor = await ReGenerateCodeAsync(context, instance);
43 | context.SetExtendedDesignerData(instance.ServiceConfig);
44 | await context.Logger.WriteMessageAsync(LoggerMessageCategory.Information, "Re-Adding service instance complete!");
45 | return await base.UpdateServiceInstanceAsync(context, cancellationToken);
46 | }
47 |
48 | private static async Task GenerateCodeAsync(
49 | ConnectedServiceHandlerContext context,
50 | Instance instance)
51 | {
52 | var codeGenDescriptor = await BaseCodeGenDescriptor.CreateAsync(context, instance);
53 | await codeGenDescriptor.AddNugetPackagesAsync();
54 | var nSwagFilePath = await codeGenDescriptor.AddGeneratedNSwagFileAsync();
55 | var clientFilePath = await codeGenDescriptor.AddGeneratedCodeAsync();
56 | return codeGenDescriptor;
57 | }
58 |
59 | private static async Task ReGenerateCodeAsync(
60 | ConnectedServiceHandlerContext context,
61 | Instance instance)
62 | {
63 | var codeGenDescriptor = await BaseCodeGenDescriptor.CreateAsync(context, instance);
64 | var nSwagFilePath = await codeGenDescriptor.AddGeneratedNSwagFileAsync();
65 | var clientFilePath = await codeGenDescriptor.AddGeneratedCodeAsync();
66 | return codeGenDescriptor;
67 | }
68 |
69 | #endregion
70 | }
71 | }
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.Shared/Instance.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.VisualStudio.ConnectedServices;
2 | using Unchase.OpenAPI.ConnectedService.Models;
3 |
4 | namespace Unchase.OpenAPI.ConnectedService
5 | {
6 | internal class Instance :
7 | ConnectedServiceInstance
8 | {
9 | #region Properties
10 |
11 | public ServiceConfiguration ServiceConfig { get; set; }
12 |
13 | public string SpecificationTempPath { get; set; }
14 |
15 | #endregion
16 |
17 | #region Constructors
18 |
19 | public Instance()
20 | {
21 | InstanceId = Constants.ExtensionCategory;
22 | Name = Constants.DefaultServiceName;
23 | }
24 |
25 | #endregion
26 | }
27 | }
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.Shared/Models/ServiceConfiguration.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.OpenApi;
2 | using Microsoft.OpenApi.OData;
3 | using NSwag.Commands;
4 | using NSwag.Commands.CodeGeneration;
5 |
6 | namespace Unchase.OpenAPI.ConnectedService.Models
7 | {
8 | internal class ServiceConfiguration
9 | {
10 | #region Properties
11 |
12 | public string ServiceName { get; set; }
13 |
14 | public bool AcceptAllUntrustedCertificates { get; set; }
15 |
16 | public string GeneratedFileName { get; set; }
17 |
18 | public string Endpoint { get; set; }
19 |
20 | public string GeneratedFileNamePrefix { get; set; }
21 |
22 | public bool GenerateCSharpClient { get; set; } = false;
23 |
24 | public bool GenerateTypeScriptClient { get; set; } = false;
25 |
26 | public bool GenerateCSharpController { get; set; } = false;
27 |
28 | public OpenApiToCSharpClientCommand OpenApiToCSharpClientCommand { get; set; }
29 |
30 | public bool ExcludeTypeNamesLater { get; set; }
31 |
32 | public OpenApiToTypeScriptClientCommand OpenApiToTypeScriptClientCommand { get; set; }
33 |
34 | public OpenApiToCSharpControllerCommand OpenApiToCSharpControllerCommand { get; set; }
35 |
36 | public string Variables { get; set; }
37 |
38 | public Runtime Runtime { get; set; }
39 |
40 | public bool CopySpecification { get; set; }
41 |
42 | public bool OpenGeneratedFilesOnComplete { get; set; }
43 |
44 | public bool UseRelativePath { get; set; }
45 |
46 | public bool ConvertFromOdata { get; set; }
47 |
48 | public OpenApiConvertSettings OpenApiConvertSettings { get; set; }
49 |
50 | public OpenApiSpecVersion OpenApiSpecVersion { get; set; }
51 |
52 | #endregion
53 |
54 | #region Network Credentials
55 |
56 | public bool UseNetworkCredentials { get; set; }
57 |
58 | public string NetworkCredentialsUserName { get; set; }
59 |
60 | public string NetworkCredentialsPassword { get; set; }
61 |
62 | public string NetworkCredentialsDomain { get; set; }
63 |
64 | #endregion
65 |
66 | #region WebProxy
67 |
68 | public string WebProxyUri { get; set; }
69 |
70 | public bool UseWebProxy { get; set; }
71 |
72 | public bool UseWebProxyCredentials { get; set; }
73 |
74 | public string WebProxyNetworkCredentialsUserName { get; set; }
75 |
76 | public string WebProxyNetworkCredentialsPassword { get; set; }
77 |
78 | public string WebProxyNetworkCredentialsDomain { get; set; }
79 |
80 | #endregion
81 | }
82 | }
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.Shared/Models/UserSettings.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Collections.ObjectModel;
3 | using System.Runtime.Serialization;
4 | using System.Threading.Tasks;
5 | using Microsoft.OpenApi;
6 | using Microsoft.OpenApi.OData;
7 | using Microsoft.VisualStudio.ConnectedServices;
8 | using NSwag.Commands;
9 | using Unchase.OpenAPI.ConnectedService.Common;
10 |
11 | namespace Unchase.OpenAPI.ConnectedService.Models
12 | {
13 | [DataContract]
14 | internal class UserSettings
15 | {
16 | #region Private
17 |
18 | private const string Name = "Settings";
19 |
20 | private const int MaxMruEntries = 10;
21 |
22 | private ConnectedServiceLogger _logger;
23 |
24 | #endregion
25 |
26 | #region Public properties
27 |
28 | [DataMember]
29 | public ObservableCollection MruEndpoints { get; private set; }
30 |
31 | [DataMember]
32 | public bool GenerateCSharpClient { get; set; } = false;
33 |
34 | [DataMember]
35 | public bool GenerateTypeScriptClient { get; set; } = false;
36 |
37 | [DataMember]
38 | public bool GenerateCSharpController { get; set; } = false;
39 |
40 | [DataMember]
41 | public string Variables { get; set; }
42 |
43 | [DataMember]
44 | public Runtime Runtime { get; set; }
45 |
46 | [DataMember]
47 | public bool CopySpecification { get; set; } = false;
48 |
49 | [DataMember]
50 | public string Endpoint { get; set; }
51 |
52 | [DataMember]
53 | public string ServiceName { get; set; }
54 |
55 | [DataMember]
56 | public string GeneratedFileName { get; set; }
57 |
58 | [DataMember]
59 | public bool OpenGeneratedFilesOnComplete { get; set; } = false;
60 |
61 | [DataMember]
62 | public bool UseRelativePath { get; set; } = false;
63 |
64 | [DataMember]
65 | public bool ConvertFromOdata { get; set; } = false;
66 |
67 | [DataMember]
68 | public OpenApiConvertSettings OpenApiConvertSettings { get; set; } = new OpenApiConvertSettings();
69 |
70 | [DataMember]
71 | public OpenApiSpecVersion OpenApiSpecVersion { get; set; }
72 |
73 | [DataMember]
74 | public bool AcceptAllUntrustedCertificates { get; set; } = true;
75 |
76 | public string ProjectPath { get; set; }
77 |
78 | #endregion
79 |
80 | #region Constructors
81 |
82 | private UserSettings()
83 | {
84 | MruEndpoints = new ObservableCollection();
85 | }
86 |
87 | #endregion
88 |
89 | #region Public methods
90 |
91 | ///
92 | /// Set properties from .
93 | ///
94 | /// .
95 | internal void SetFromServiceConfiguration(ServiceConfiguration serviceConfiguration)
96 | {
97 | CopySpecification = serviceConfiguration.CopySpecification;
98 | Endpoint = serviceConfiguration.Endpoint;
99 | GenerateCSharpClient = serviceConfiguration.GenerateCSharpClient;
100 | GenerateCSharpController = serviceConfiguration.GenerateCSharpController;
101 | GenerateTypeScriptClient = serviceConfiguration.GenerateTypeScriptClient;
102 | OpenGeneratedFilesOnComplete = serviceConfiguration.OpenGeneratedFilesOnComplete;
103 | Runtime = serviceConfiguration.Runtime;
104 | ServiceName = serviceConfiguration.ServiceName;
105 | AcceptAllUntrustedCertificates = serviceConfiguration.AcceptAllUntrustedCertificates;
106 | GeneratedFileName = serviceConfiguration.GeneratedFileName;
107 | UseRelativePath = serviceConfiguration.UseRelativePath;
108 | ConvertFromOdata = serviceConfiguration.ConvertFromOdata;
109 | OpenApiConvertSettings = serviceConfiguration.OpenApiConvertSettings;
110 | OpenApiSpecVersion = serviceConfiguration.OpenApiSpecVersion;
111 | Variables = serviceConfiguration.Variables;
112 | }
113 |
114 | public Task SaveAsync()
115 | {
116 | return UserSettingsPersistenceHelper.SaveAsync(this, Constants.ProviderId, Name, null, _logger);
117 | }
118 |
119 | public static async Task LoadAsync(ConnectedServiceLogger logger)
120 | {
121 | var userSettings = (await UserSettingsPersistenceHelper.LoadAsync(
122 | Constants.ProviderId, Name, null, logger)) ?? new UserSettings();
123 | userSettings._logger = logger;
124 | return userSettings;
125 | }
126 |
127 | public static void AddToTopOfMruList(ObservableCollection mruList, T item)
128 | {
129 | var index = mruList.IndexOf(item);
130 | if (index >= 0)
131 | {
132 | // Ensure there aren't any duplicates in the list.
133 | for (var i = mruList.Count - 1; i > index; i--)
134 | {
135 | if (EqualityComparer.Default.Equals(mruList[i], item))
136 | {
137 | mruList.RemoveAt(i);
138 | }
139 | }
140 |
141 | if (index > 0)
142 | {
143 | // The item is in the MRU list but it is not at the top.
144 | mruList.Move(index, 0);
145 | }
146 | }
147 | else
148 | {
149 | // The item is not in the MRU list, make room for it by clearing out the oldest item.
150 | while (mruList.Count >= MaxMruEntries)
151 | {
152 | mruList.RemoveAt(mruList.Count - 1);
153 | }
154 |
155 | mruList.Insert(0, item);
156 | }
157 | }
158 |
159 | #endregion
160 | }
161 | }
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.Shared/Options.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Windows;
6 |
7 | using Microsoft.VisualStudio.Shell;
8 | using Microsoft.Win32;
9 | using Unchase.OpenAPI.ConnectedService;
10 |
11 | public class Options :
12 | DialogPage
13 | {
14 | [Category("General")]
15 | [DisplayName("Path to NSwagStudio.exe")]
16 | [Description("Specify the path to NSwagStudio.exe.")]
17 | public string PathToNSwagStudioExe { get; set; } = NSwagStudioExePath();
18 |
19 | [Category("General")]
20 | [DisplayName("OpenAPI (Swagger) specification endpoint")]
21 | [Description("Specify the OpenAPI (Swagger) specification enpoint to diff.")]
22 | public string OpenApiSpecificationEndpoint { get; set; }
23 |
24 | protected override void OnApply(PageApplyEventArgs e)
25 | {
26 | if (!File.Exists(PathToNSwagStudioExe))
27 | {
28 | e.ApplyBehavior = ApplyKind.Cancel;
29 | MessageBox.Show($"The file \"{PathToNSwagStudioExe}\" doesn't exist.", Constants.ExtensionName, MessageBoxButton.OK, MessageBoxImage.Exclamation);
30 | }
31 |
32 | if (!string.IsNullOrWhiteSpace(OpenApiSpecificationEndpoint) && !OpenApiSpecificationEndpoint.EndsWith(".json"))
33 | {
34 | e.ApplyBehavior = ApplyKind.Cancel;
35 | MessageBox.Show($"The OpenAPI (Swagger) specification endpoint \"{OpenApiSpecificationEndpoint}\" should ends with \".json\".", Constants.ExtensionName, MessageBoxButton.OK, MessageBoxImage.Exclamation);
36 | }
37 |
38 | // TODO - check if endpoint not exists
39 |
40 | base.OnApply(e);
41 | }
42 |
43 | internal static string NSwagStudioExePath()
44 | {
45 | var path = string.Empty;
46 | using (var key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Classes\NSwagFile\shell\open\command"))
47 | {
48 | if (key != null)
49 | {
50 | var commandParts = key
51 | .GetValue(null)
52 | .ToString()
53 | .Split(new[] { '"' }, StringSplitOptions.RemoveEmptyEntries)
54 | .Where(part => !string.IsNullOrWhiteSpace(part))
55 | .ToArray();
56 |
57 | if (commandParts.Length == 2)
58 | {
59 | path = commandParts.First();
60 | }
61 | }
62 |
63 | if (string.IsNullOrEmpty(path) || !File.Exists(path))
64 | {
65 | path = Environment.ExpandEnvironmentVariables("%ProgramFiles(x86)%\\Rico Suter\\NSwagStudio\\NSwagStudio.exe");
66 | }
67 |
68 | if (string.IsNullOrEmpty(path) || !File.Exists(path))
69 | {
70 | path = Environment.ExpandEnvironmentVariables("%ProgramW6432%\\Rico Suter\\NSwagStudio\\NSwagStudio.exe");
71 | }
72 |
73 | if (string.IsNullOrEmpty(path) || !File.Exists(path))
74 | {
75 | path = string.Empty;
76 | }
77 |
78 | return path;
79 | }
80 | }
81 | }
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.Shared/Provider.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Threading.Tasks;
4 | using System.Windows;
5 | using System.Windows.Interop;
6 | using System.Windows.Media.Imaging;
7 |
8 | using Microsoft.VisualStudio.ConnectedServices;
9 | #if VS17
10 | using Unchase.OpenAPI.Connectedservice.VS22.Properties;
11 | #else
12 | using Unchase.OpenAPI.ConnectedService.Properties;
13 | #endif
14 |
15 | namespace Unchase.OpenAPI.ConnectedService
16 | {
17 | [ConnectedServiceProviderExport(Constants.ProviderId, SupportsUpdate = true)]
18 | internal class Provider :
19 | ConnectedServiceProvider
20 | {
21 | #region Constructors
22 |
23 | public Provider()
24 | {
25 | Category = Constants.ExtensionCategory;
26 | Name = Constants.ExtensionName;
27 | Description = Constants.ExtensionDescription;
28 | Icon = Imaging.CreateBitmapSourceFromHBitmap(
29 | Resources.preview_200x200.GetHbitmap(),
30 | IntPtr.Zero,
31 | Int32Rect.Empty,
32 | BitmapSizeOptions.FromWidthAndHeight(64, 64)
33 | );
34 | CreatedBy = Constants.Author;
35 | Version = typeof(Provider).Assembly.GetName().Version;
36 | MoreInfoUri = new Uri(Constants.Website);
37 | }
38 |
39 | #endregion
40 |
41 | #region Methods
42 |
43 | public override async Task CreateConfiguratorAsync(ConnectedServiceProviderContext context)
44 | {
45 | return await Wizard.CreateAsync(context);
46 | }
47 |
48 | public override IEnumerable> GetSupportedTechnologyLinks()
49 | {
50 | yield return Tuple.Create("OpenAPI (Swagger)", new Uri("https://swagger.io/docs/specification/about/"));
51 | yield return Tuple.Create("NSwag", new Uri("https://github.com/RSuter/NSwag"));
52 | }
53 |
54 | #endregion
55 | }
56 | }
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.Shared/Resources/NewBug.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unchase/Unchase.OpenAPI.Connectedservice/125976bb4c05817d8afe2d0f47b0c2f8a3b714f5/src/Unchase.OpenAPI.Connectedservice.Shared/Resources/NewBug.png
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.Shared/Resources/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unchase/Unchase.OpenAPI.Connectedservice/125976bb4c05817d8afe2d0f47b0c2f8a3b714f5/src/Unchase.OpenAPI.Connectedservice.Shared/Resources/favicon.ico
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.Shared/Resources/logo_128x128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unchase/Unchase.OpenAPI.Connectedservice/125976bb4c05817d8afe2d0f47b0c2f8a3b714f5/src/Unchase.OpenAPI.Connectedservice.Shared/Resources/logo_128x128.png
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.Shared/Resources/preview_200x200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unchase/Unchase.OpenAPI.Connectedservice/125976bb4c05817d8afe2d0f47b0c2f8a3b714f5/src/Unchase.OpenAPI.Connectedservice.Shared/Resources/preview_200x200.png
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.Shared/Unchase.OpenAPI.Connectedservice.Shared.projitems:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath)
5 | true
6 | f9c2b492-3068-4f7d-9aa4-d4cd086c4468
7 |
8 |
9 | Unchase.OpenAPI.Connectedservice.Shared
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | Component
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 | ConfigOpenApiEndpoint.xaml
45 |
46 |
47 | CSharpClientExcludedClasses.xaml
48 |
49 |
50 | CSharpClientSettings.xaml
51 |
52 |
53 | CSharpControllerSettings.xaml
54 |
55 |
56 | TypeScriptClientSettings.xaml
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 | Always
65 |
66 |
67 | Always
68 |
69 |
70 | Always
71 |
72 |
73 | Always
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 | Designer
82 |
83 |
84 |
85 |
86 | Never
87 |
88 |
89 |
90 |
91 | Designer
92 | MSBuild:Compile
93 |
94 |
95 | Designer
96 | MSBuild:Compile
97 |
98 |
99 | Designer
100 | MSBuild:Compile
101 |
102 |
103 | Designer
104 | MSBuild:Compile
105 |
106 |
107 | Designer
108 | MSBuild:Compile
109 |
110 |
111 |
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.Shared/Unchase.OpenAPI.Connectedservice.Shared.shproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | f9c2b492-3068-4f7d-9aa4-d4cd086c4468
5 | 14.0
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.Shared/ViewModels/CSharpClientSettingsViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 |
4 | using Microsoft.VisualStudio.ConnectedServices;
5 | using NJsonSchema.CodeGeneration.CSharp;
6 | using NSwag.Commands;
7 | using NSwag.Commands.CodeGeneration;
8 | using Unchase.OpenAPI.ConnectedService.Views;
9 |
10 | namespace Unchase.OpenAPI.ConnectedService.ViewModels
11 | {
12 | internal class CSharpClientSettingsViewModel :
13 | ConnectedServiceWizardPage
14 | {
15 | #region Properties
16 |
17 | public string GeneratedFileName { get; set; }
18 |
19 | public OpenApiToCSharpClientCommand Command { get; set; } = new OpenApiToCSharpClientCommand
20 | {
21 | Namespace = string.Empty,
22 | OperationGenerationMode = OperationGenerationMode.SingleClientFromPathSegments
23 | };
24 |
25 | /// Gets the list of operation modes.
26 | public OperationGenerationMode[] OperationGenerationModes { get; } = Enum.GetNames(typeof(OperationGenerationMode))
27 | .Select(t => (OperationGenerationMode)Enum.Parse(typeof(OperationGenerationMode), t))
28 | .ToArray();
29 |
30 | /// Gets the list of class styles.
31 | public CSharpClassStyle[] ClassStyles { get; } = Enum.GetNames(typeof(CSharpClassStyle))
32 | .Select(t => (CSharpClassStyle)Enum.Parse(typeof(CSharpClassStyle), t))
33 | .ToArray();
34 |
35 | /// Gets the list of JSON libraries.
36 | public CSharpJsonLibrary[] JsonLibraries { get; } = Enum.GetNames(typeof(CSharpJsonLibrary))
37 | .Select(t => (CSharpJsonLibrary)Enum.Parse(typeof(CSharpJsonLibrary), t))
38 | .ToArray();
39 |
40 | /// Gets new line behaviors.
41 | public NewLineBehavior[] NewLineBehaviors { get; } = Enum.GetNames(typeof(NewLineBehavior))
42 | .Select(t => (NewLineBehavior)Enum.Parse(typeof(NewLineBehavior), t))
43 | .ToArray();
44 |
45 | public bool ExcludeTypeNamesLater { get; set; }
46 |
47 | #endregion
48 |
49 | #region Constructors
50 |
51 | public CSharpClientSettingsViewModel() : base()
52 | {
53 | Title = "CSharp Client Settings";
54 | Description = "Settings for generating CSharp client";
55 | Legend = "CSharp Client Settings";
56 | View = new CSharpClientSettings {DataContext = this};
57 | }
58 |
59 | #endregion
60 | }
61 | }
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.Shared/ViewModels/CSharpControllerSettingsViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 |
4 | using Microsoft.VisualStudio.ConnectedServices;
5 | using NJsonSchema.CodeGeneration.CSharp;
6 | using NSwag.CodeGeneration.CSharp.Models;
7 | using NSwag.Commands;
8 | using NSwag.Commands.CodeGeneration;
9 | using Unchase.OpenAPI.ConnectedService.Views;
10 |
11 | namespace Unchase.OpenAPI.ConnectedService.ViewModels
12 | {
13 | internal class CSharpControllerSettingsViewModel :
14 | ConnectedServiceWizardPage
15 | {
16 | #region Properties
17 |
18 | public OpenApiToCSharpControllerCommand Command { get; set; } = new OpenApiToCSharpControllerCommand { Namespace = string.Empty };
19 |
20 | /// Gets the list of operation modes.
21 | public OperationGenerationMode[] OperationGenerationModes { get; } = Enum.GetNames(typeof(OperationGenerationMode))
22 | .Select(t => (OperationGenerationMode)Enum.Parse(typeof(OperationGenerationMode), t))
23 | .ToArray();
24 |
25 | /// Gets the list of class styles.
26 | public CSharpClassStyle[] ClassStyles { get; } = Enum.GetNames(typeof(CSharpClassStyle))
27 | .Select(t => (CSharpClassStyle)Enum.Parse(typeof(CSharpClassStyle), t))
28 | .ToArray();
29 |
30 | /// Gets the list of class styles.
31 | public CSharpControllerStyle[] ControllerStyles { get; } = Enum.GetNames(typeof(CSharpControllerStyle))
32 | .Select(t => (CSharpControllerStyle)Enum.Parse(typeof(CSharpControllerStyle), t))
33 | .ToArray();
34 |
35 | /// Gets the list of class targets.
36 | public CSharpControllerTarget[] ControllerTargets { get; } = Enum.GetNames(typeof(CSharpControllerTarget))
37 | .Select(t => (CSharpControllerTarget)Enum.Parse(typeof(CSharpControllerTarget), t))
38 | .ToArray();
39 |
40 | /// Gets the list of route naming strategies.
41 | public CSharpControllerRouteNamingStrategy[] RouteNamingStrategies { get; } = Enum.GetNames(typeof(CSharpControllerRouteNamingStrategy))
42 | .Select(t => (CSharpControllerRouteNamingStrategy)Enum.Parse(typeof(CSharpControllerRouteNamingStrategy), t))
43 | .ToArray();
44 |
45 | /// Gets new line behaviors.
46 | public NewLineBehavior[] NewLineBehaviors { get; } = Enum.GetNames(typeof(NewLineBehavior))
47 | .Select(t => (NewLineBehavior)Enum.Parse(typeof(NewLineBehavior), t))
48 | .ToArray();
49 |
50 | #endregion
51 |
52 | #region Constructors
53 |
54 | public CSharpControllerSettingsViewModel() : base()
55 | {
56 | Title = "CSharp Controller Settings";
57 | Description = "Settings for generating CSharp controller";
58 | Legend = "CSharp Controller Settings";
59 | View = new CSharpControllerSettings {DataContext = this};
60 | }
61 |
62 | #endregion
63 | }
64 | }
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.Shared/ViewModels/TypeScriptClientSettingsViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 | using Microsoft.VisualStudio.ConnectedServices;
4 | using NJsonSchema.CodeGeneration.TypeScript;
5 | using NSwag.CodeGeneration.TypeScript;
6 | using NSwag.Commands;
7 | using NSwag.Commands.CodeGeneration;
8 | using Unchase.OpenAPI.ConnectedService.Views;
9 |
10 | namespace Unchase.OpenAPI.ConnectedService.ViewModels
11 | {
12 | internal class TypeScriptClientSettingsViewModel :
13 | ConnectedServiceWizardPage
14 | {
15 | #region Properties
16 |
17 | public OpenApiToTypeScriptClientCommand Command { get; set; } = new OpenApiToTypeScriptClientCommand();
18 |
19 | /// Gets the supported TypeScript versions.
20 | public decimal[] TypeScriptVersions => new[] { 1.8m, 2.0m, 2.4m, 2.7m, 4.3m };
21 |
22 | /// Gets the supported RxJs versions.
23 | public decimal[] RxJsVersions => new[] { 5.0m, 6.0m };
24 |
25 | /// Gets the output templates.
26 | public TypeScriptTemplate[] Templates { get; } = Enum.GetNames(typeof(TypeScriptTemplate))
27 | .Select(t => (TypeScriptTemplate)Enum.Parse(typeof(TypeScriptTemplate), t))
28 | .ToArray();
29 |
30 | /// Gets the operation modes.
31 | public OperationGenerationMode[] OperationGenerationModes { get; } = Enum.GetNames(typeof(OperationGenerationMode))
32 | .Select(t => (OperationGenerationMode)Enum.Parse(typeof(OperationGenerationMode), t))
33 | .ToArray();
34 |
35 | /// Gets the promise types.
36 | public PromiseType[] PromiseTypes { get; } = Enum.GetNames(typeof(PromiseType))
37 | .Select(t => (PromiseType)Enum.Parse(typeof(PromiseType), t))
38 | .ToArray();
39 |
40 | /// Gets the promise types.
41 | public HttpClass[] HttpClasses { get; } = Enum.GetNames(typeof(HttpClass))
42 | .Select(t => (HttpClass)Enum.Parse(typeof(HttpClass), t))
43 | .ToArray();
44 |
45 | /// Gets the promise types.
46 | public InjectionTokenType[] InjectionTokenTypes { get; } = Enum.GetNames(typeof(InjectionTokenType))
47 | .Select(t => (InjectionTokenType)Enum.Parse(typeof(InjectionTokenType), t))
48 | .ToArray();
49 |
50 | /// Gets the list of type styles.
51 | public TypeScriptTypeStyle[] TypeStyles { get; } = Enum.GetNames(typeof(TypeScriptTypeStyle))
52 | .Select(t => (TypeScriptTypeStyle)Enum.Parse(typeof(TypeScriptTypeStyle), t))
53 | .ToArray();
54 |
55 | /// Gets the list of enum styles.
56 | public TypeScriptEnumStyle[] EnumStyles { get; } = Enum.GetNames(typeof(TypeScriptEnumStyle))
57 | .Select(t => (TypeScriptEnumStyle)Enum.Parse(typeof(TypeScriptEnumStyle), t))
58 | .ToArray();
59 |
60 | /// Gets the list of date time types.
61 | public TypeScriptDateTimeType[] DateTimeTypes { get; } = Enum.GetNames(typeof(TypeScriptDateTimeType))
62 | .Select(t => (TypeScriptDateTimeType)Enum.Parse(typeof(TypeScriptDateTimeType), t))
63 | .ToArray();
64 |
65 | /// Gets the list of null values.
66 | public TypeScriptNullValue[] NullValues { get; } = Enum.GetNames(typeof(TypeScriptNullValue))
67 | .Select(t => (TypeScriptNullValue)Enum.Parse(typeof(TypeScriptNullValue), t))
68 | .ToArray();
69 |
70 | /// Gets new line behaviors.
71 | public NewLineBehavior[] NewLineBehaviors { get; } = Enum.GetNames(typeof(NewLineBehavior))
72 | .Select(t => (NewLineBehavior)Enum.Parse(typeof(NewLineBehavior), t))
73 | .ToArray();
74 |
75 | #endregion
76 |
77 | #region Constructors
78 |
79 | public TypeScriptClientSettingsViewModel() : base()
80 | {
81 | Title = "TypeScript Client Settings";
82 | Description = "Settings for generating TypeScript client";
83 | Legend = "TypeScript Client Settings";
84 | View = new TypeScriptClientSettings {DataContext = this};
85 | }
86 |
87 | #endregion
88 | }
89 | }
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.Shared/Views/CSharpClientExcludedClasses.xaml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
26 |
27 |
28 |
29 |
35 |
40 |
41 |
42 |
43 |
44 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.Shared/Views/CSharpClientExcludedClasses.xaml.cs:
--------------------------------------------------------------------------------
1 | //-----------------------------------------------------------------------
2 | //
3 | // Copyright (c) Nikolay Chebotov (Unchase). All rights reserved.
4 | //
5 | // https://github.com/unchase/Unchase.OpenAPI.Connectedservice/blob/master/LICENSE.md
6 | // Nickolay Chebotov (Unchase), spiritkola@hotmail.com
7 | //-----------------------------------------------------------------------
8 |
9 | using System.Collections.Generic;
10 | using System.Collections.ObjectModel;
11 | using System.Windows;
12 |
13 | namespace Unchase.OpenAPI.ConnectedService.Views
14 | {
15 | ///
16 | /// Логика взаимодействия для CSharpClientExcludedClasses.xaml
17 | ///
18 | public partial class CSharpClientExcludedClasses : Window
19 | {
20 | public ObservableCollection Classes { get; set; }
21 |
22 | public class Class
23 | {
24 | public string Name { get; set; }
25 |
26 | public bool Excluded { get; set; }
27 | }
28 |
29 | public CSharpClientExcludedClasses(IEnumerable classNames)
30 | {
31 | InitializeComponent();
32 | Classes = new ObservableCollection();
33 | foreach (var className in classNames)
34 | {
35 | Classes.Add(new Class
36 | {
37 | Name = className,
38 | Excluded = false
39 | });
40 | }
41 | ExcludedClassesListBox.ItemsSource = Classes;
42 | }
43 |
44 | private void ApplyButton_Click(object sender, RoutedEventArgs e)
45 | {
46 | DialogResult = true;
47 | Close();
48 | }
49 | }
50 | }
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.Shared/Views/CSharpClientSettings.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Controls;
2 |
3 | namespace Unchase.OpenAPI.ConnectedService.Views
4 | {
5 | public partial class CSharpClientSettings : UserControl
6 | {
7 | public CSharpClientSettings()
8 | {
9 | InitializeComponent();
10 | }
11 | }
12 | }
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.Shared/Views/CSharpControllerSettings.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Controls;
2 |
3 | namespace Unchase.OpenAPI.ConnectedService.Views
4 | {
5 | public partial class CSharpControllerSettings : UserControl
6 | {
7 | public CSharpControllerSettings()
8 | {
9 | InitializeComponent();
10 | }
11 | }
12 | }
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.Shared/Views/ConfigOpenApiEndpoint.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text.RegularExpressions;
3 | using System.Windows;
4 | using System.Windows.Controls;
5 | using System.Windows.Input;
6 | using System.Windows.Navigation;
7 |
8 | using Unchase.OpenAPI.ConnectedService.ViewModels;
9 |
10 | namespace Unchase.OpenAPI.ConnectedService.Views
11 | {
12 | public partial class ConfigOpenApiEndpoint : UserControl
13 | {
14 | #region Properties and Fields
15 |
16 | private readonly Wizard _wizard;
17 |
18 | private const string ReportABugUrlFormat = "https://github.com/unchase/Unchase.OpenAPI.Connectedservice/issues/new?title={0}&labels=bug&body={1}";
19 |
20 | #endregion
21 |
22 | #region Constructors
23 |
24 | internal ConfigOpenApiEndpoint(Wizard wizard)
25 | {
26 | InitializeComponent();
27 | _wizard = wizard;
28 | }
29 |
30 | #endregion
31 |
32 | #region Methods
33 |
34 | #region Events
35 |
36 | private void GenerateCSharpClient_OnUnchecked(object sender, RoutedEventArgs e)
37 | {
38 | _wizard.RemoveCSharpClientSettingsPage();
39 | }
40 |
41 | private void GenerateCSharpClient_OnChecked(object sender, RoutedEventArgs e)
42 | {
43 | _wizard.AddCSharpClientSettingsPage();
44 | }
45 |
46 | private void GenerateCSharpController_OnChecked(object sender, RoutedEventArgs e)
47 | {
48 | _wizard.AddCSharpControllerSettingsPage();
49 | }
50 |
51 | private void GenerateCSharpController_OnUnchecked(object sender, RoutedEventArgs e)
52 | {
53 | _wizard.RemoveCSharpControllerSettingsPage();
54 | }
55 |
56 | private void GenerateTypeScriptClient_OnChecked(object sender, RoutedEventArgs e)
57 | {
58 | _wizard.AddTypeScriptClientSettingsPage();
59 | }
60 |
61 | private void GenerateTypeScriptClient_OnUnchecked(object sender, RoutedEventArgs e)
62 | {
63 | _wizard.RemoveTypeScriptClientSettingsPage();
64 | }
65 |
66 | #endregion
67 |
68 | private void ReportABugButton_Click(object sender, RoutedEventArgs e)
69 | {
70 | var title = Uri.EscapeUriString("");
71 | var body = Uri.EscapeUriString("");
72 | var url = string.Format(ReportABugUrlFormat, title, body);
73 | System.Diagnostics.Process.Start(url);
74 | }
75 |
76 | private void OpenEndpointFileButton_OnClick(object sender, RoutedEventArgs e)
77 | {
78 | var openFileDialog = new Microsoft.Win32.OpenFileDialog
79 | {
80 | DefaultExt = (DataContext as ConfigOpenApiEndpointViewModel)?.UserSettings?.ConvertFromOdata == true ? ".xml" : ".json",
81 | Filter = "Specification Files (.*)|*.*",
82 | Title = "Open specification file"
83 | };
84 | var result = openFileDialog.ShowDialog();
85 | if (result == true)
86 | {
87 | if (_wizard.ConfigOpenApiEndpointViewModel.UserSettings.UseRelativePath &&
88 | openFileDialog.FileName.StartsWith(_wizard.ProjectPath, StringComparison.OrdinalIgnoreCase))
89 | {
90 | Endpoint.Text = openFileDialog.FileName.Substring(_wizard.ProjectPath.Length);
91 | }
92 | else
93 | {
94 | Endpoint.Text = openFileDialog.FileName;
95 | }
96 | }
97 | }
98 |
99 | private void NumericTexBox_OnPreviewTextInput(object sender, TextCompositionEventArgs e)
100 | {
101 | var regex = new Regex("[^0-9]+");
102 | e.Handled = regex.IsMatch(e.Text);
103 | }
104 |
105 | private void Hyperlink_OnRequestNavigate(object sender, RequestNavigateEventArgs e)
106 | {
107 | System.Diagnostics.Process.Start(e.Uri.AbsoluteUri);
108 | }
109 |
110 | #endregion
111 | }
112 | }
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.Shared/Views/TypeScriptClientSettings.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 | using System.Windows.Controls;
3 |
4 | namespace Unchase.OpenAPI.ConnectedService.Views
5 | {
6 | public partial class TypeScriptClientSettings : UserControl
7 | {
8 | public TypeScriptClientSettings()
9 | {
10 | InitializeComponent();
11 | }
12 |
13 | private void OpenExtensionCodeFileButton_OnClick(object sender, RoutedEventArgs e)
14 | {
15 | var openFileDialog = new Microsoft.Win32.OpenFileDialog
16 | {
17 | DefaultExt = ".ts",
18 | Filter = "TypeScript Files (.ts)|*.ts",
19 | Title = "Open Class extension code file"
20 | };
21 | var result = openFileDialog.ShowDialog();
22 | if (result == true)
23 | {
24 | var filename = openFileDialog.FileName;
25 | ExtensionCodeFileTextBox.Text = filename;
26 | }
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.VS22/EULA.txt:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright 2019 Nikolay Chebotov (Unchase)
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.VS22/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 | using Unchase.OpenAPI.ConnectedService;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle(Constants.ExtensionName)]
9 | [assembly: AssemblyDescription(Constants.ExtensionDescription)]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany(Constants.Author)]
12 | [assembly: AssemblyProduct(Constants.ProviderId)]
13 | [assembly: AssemblyCopyright(Constants.Copyright)]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // Version information for an assembly consists of the following four values:
23 | //
24 | // Major Version
25 | // Minor Version
26 | // Build Number
27 | // Revision
28 | //
29 | // You can specify all the values or you can default the Build and Revision Numbers
30 | // by using the '*' as shown below:
31 | // [assembly: AssemblyVersion("1.0.*")]
32 | [assembly: AssemblyVersion(Constants.Vsix.Version)]
33 | [assembly: AssemblyFileVersion(Constants.Vsix.Version)]
34 |
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.VS22/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Unchase.OpenAPI.Connectedservice.VS22.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Unchase.OpenAPI.Connectedservice.VS22.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 |
63 | ///
64 | /// Looks up a localized resource of type System.Drawing.Bitmap.
65 | ///
66 | internal static System.Drawing.Bitmap preview_200x200 {
67 | get {
68 | object obj = ResourceManager.GetObject("preview_200x200", resourceCulture);
69 | return ((System.Drawing.Bitmap)(obj));
70 | }
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.VS22/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 |
122 | ..\Resources\preview_200x200.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
123 |
124 |
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.VS22/Resources/logo_128x128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unchase/Unchase.OpenAPI.Connectedservice/125976bb4c05817d8afe2d0f47b0c2f8a3b714f5/src/Unchase.OpenAPI.Connectedservice.VS22/Resources/logo_128x128.png
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.VS22/Resources/preview_200x200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unchase/Unchase.OpenAPI.Connectedservice/125976bb4c05817d8afe2d0f47b0c2f8a3b714f5/src/Unchase.OpenAPI.Connectedservice.VS22/Resources/preview_200x200.png
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.VS22/Unchase.OpenAPI.Connectedservice.VS22.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 17.0
5 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
6 |
7 |
8 |
9 | Debug
10 | AnyCPU
11 | 2.0
12 | {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
13 | {CD7B2A0B-DF06-4B0D-BA4A-D996CAAAE8E9}
14 | Library
15 | Properties
16 | Unchase.OpenAPI.Connectedservice.VS22
17 | Unchase.OpenAPI.Connectedservice.VS22
18 | v4.7.2
19 | true
20 | true
21 | true
22 | false
23 | false
24 | true
25 | true
26 | Program
27 | $(DevEnvDir)devenv.exe
28 | /rootsuffix Exp
29 |
30 |
31 | true
32 | full
33 | false
34 | bin\Debug\
35 | TRACE;DEBUG;VS17
36 | prompt
37 | 4
38 |
39 |
40 | pdbonly
41 | true
42 | bin\Release\
43 | TRACE;VS17
44 | prompt
45 | 4
46 |
47 |
48 |
49 |
50 | True
51 | True
52 | Resources.resx
53 |
54 |
55 |
56 |
57 | Designer
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 | 17.0.31902.203
70 |
71 |
72 | 2.10.0
73 |
74 |
75 | 1.1.1
76 |
77 |
78 | 7.6.1
79 |
80 |
81 | 1.2.2
82 |
83 |
84 | 1.0.9
85 |
86 |
87 | 16.2.45
88 |
89 |
90 |
91 | 17.0.31902.203
92 |
93 |
94 | 17.0.31902.203
95 |
96 |
97 |
98 | 5.0.0
99 | compile; contentfiles; build; analyzers
100 | compile
101 |
102 |
103 | 5.0.0
104 | compile; contentfiles; build; analyzers
105 | compile
106 |
107 |
108 | 13.19.0
109 |
110 |
111 | 6.0.0
112 |
113 |
114 | 4.5.0
115 | compile; contentfiles; build; analyzers
116 | compile
117 |
118 |
119 | 5.0.0
120 | compile; contentfiles; build; analyzers
121 | compile
122 |
123 |
124 | 5.0.0
125 | compile; contentfiles; build; analyzers
126 | compile
127 |
128 |
129 | 6.0.0
130 |
131 |
132 | 5.0.0
133 | compile; contentfiles; build; analyzers
134 | compile
135 |
136 |
137 |
138 |
139 | ResXFileCodeGenerator
140 | Resources.Designer.cs
141 | Designer
142 |
143 |
144 |
145 |
146 | true
147 |
148 |
149 | Always
150 | true
151 |
152 |
153 | Always
154 | true
155 |
156 |
157 |
158 |
159 |
160 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 | <_Temp Remove="@(_Temp)" />
176 |
177 |
178 |
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice.VS22/source.extension.vsixmanifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Unchase OpenAPI (Swagger) Connected Service VS2022
6 | Connected service for Visual Studio 2022 to generate OpenAPI (Swagger) web service reference.
7 | https://github.com/unchase/Unchase.OpenAPI.Connectedservice
8 | EULA.txt
9 | https://github.com/unchase/Unchase.OpenAPI.Connectedservice/blob/master/README.md
10 | https://github.com/unchase/Unchase.OpenAPI.Connectedservice/blob/master/CHANGELOG.md
11 | Resources\logo_128x128.png
12 | Resources\preview_200x200.png
13 | OpenAPI, Swagger, REST API, OAS, OAI, Web API, .NET Core, HttpClient, Swashbuckle, NSwag, NSwagStudio, Code Generation, Scaffolding, Connected Service
14 |
15 |
16 |
19 |
20 | amd64
21 |
22 |
23 | amd64
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice/EULA.txt:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright 2019 Nikolay Chebotov (Unchase)
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Resources;
2 | using System.Reflection;
3 | using System.Runtime.InteropServices;
4 | using Unchase.OpenAPI.ConnectedService;
5 | using Microsoft.VisualStudio.Shell;
6 |
7 | // General Information about an assembly is controlled through the following
8 | // set of attributes. Change these attribute values to modify the information
9 | // associated with an assembly.
10 | [assembly: AssemblyTitle(Constants.ExtensionName)]
11 | [assembly: AssemblyDescription(Constants.ExtensionDescription)]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany(Constants.Author)]
14 | [assembly: AssemblyProduct(Constants.ProviderId)]
15 | [assembly: AssemblyCopyright(Constants.Copyright)]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // Setting ComVisible to false makes the types in this assembly not visible
20 | // to COM components. If you need to access a type in this assembly from
21 | // COM, set the ComVisible attribute to true on that type.
22 | [assembly: ComVisible(false)]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Build and Revision Numbers
32 | // by using the '*' as shown below:
33 | // [assembly: AssemblyVersion("1.2.*")]
34 | [assembly: AssemblyVersion(Constants.Vsix.Version)]
35 | [assembly: AssemblyFileVersion(Constants.Vsix.Version)]
36 | [assembly: NeutralResourcesLanguage("en-US")]
37 |
38 | [assembly: ProvideCodeBase(AssemblyName = Constants.NewtonsoftJsonAssemblyName)]
39 | //[assembly: ProvideBindingRedirection(AssemblyName = Constants.NewtonsoftJsonAssemblyName, OldVersionLowerBound = "10.0.0.0")]
40 | [assembly: ProvideBindingRedirection(AssemblyName = Constants.NewtonsoftJsonAssemblyName, OldVersionLowerBound = "1.0.0.0")]
41 | [assembly: ProvideBindingRedirection(AssemblyName = Constants.MicrosoftExtensionsFileProvidersAbstractionsAssemblyName, OldVersionLowerBound = "1.1.1.0")]
42 | [assembly: ProvideBindingRedirection(AssemblyName = Constants.SystemRuntimeCompilerServicesUnsafeAssemblyName, OldVersionLowerBound = "0.0.0.0")]
43 |
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Unchase.OpenAPI.ConnectedService.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Unchase.OpenAPI.ConnectedService.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 |
63 | ///
64 | /// Looks up a localized resource of type System.Drawing.Bitmap.
65 | ///
66 | internal static System.Drawing.Bitmap preview_200x200 {
67 | get {
68 | object obj = ResourceManager.GetObject("preview_200x200", resourceCulture);
69 | return ((System.Drawing.Bitmap)(obj));
70 | }
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 |
122 | ..\Resources\preview_200x200.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
123 |
124 |
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice/Resources/logo_128x128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unchase/Unchase.OpenAPI.Connectedservice/125976bb4c05817d8afe2d0f47b0c2f8a3b714f5/src/Unchase.OpenAPI.Connectedservice/Resources/logo_128x128.png
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice/Resources/preview_200x200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/unchase/Unchase.OpenAPI.Connectedservice/125976bb4c05817d8afe2d0f47b0c2f8a3b714f5/src/Unchase.OpenAPI.Connectedservice/Resources/preview_200x200.png
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice/source.extension.vsixmanifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Unchase OpenAPI (Swagger) Connected Service
6 | Connected service for Visual Studio to generate OpenAPI (Swagger) web service reference.
7 | https://github.com/unchase/Unchase.OpenAPI.Connectedservice
8 | EULA.txt
9 | https://github.com/unchase/Unchase.OpenAPI.Connectedservice/blob/master/README.md
10 | https://github.com/unchase/Unchase.OpenAPI.Connectedservice/blob/master/CHANGELOG.md
11 | Resources\logo_128x128.png
12 | Resources\preview_200x200.png
13 | OpenAPI, Swagger, REST API, OAS, OAI, Web API, .NET Core, HttpClient, Swashbuckle, NSwag, NSwagStudio, Code Generation, Scaffolding, Connected Service
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/src/Unchase.OpenAPI.Connectedservice/vs-threading.MembersRequiringMainThread.txt:
--------------------------------------------------------------------------------
1 | ![Microsoft.VisualStudio.Shell.ServiceProvider]::GetGlobalServiceAsync
2 | [Microsoft.VisualStudio.Shell.ServiceProvider]
3 | [Microsoft.VisualStudio.Shell.Interop.*]
4 | [Microsoft.VisualStudio.OLE.Interop.*]
5 | [Microsoft.Internal.VisualStudio.Shell.Interop.*]
6 | ![Microsoft.VisualStudio.Shell.Interop.IAsyncServiceProvider]
7 | [Microsoft.VisualStudio.Shell.Package]::GetService
8 | [EnvDTE.*]
9 |
--------------------------------------------------------------------------------