Produced by Araxis Merge on 5/20/2019 8:52:11 AM Eastern Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | PPMS_Build_11_Sprint_3.zip\CIF B11S3\VA.PPMS.DataWebService\VA.PPMS.DataWebService\PpmsDataWebService\App_Start | SwaggerConfig.cs | Wed Apr 17 20:02:28 2019 UTC |
| 2 | PPMS_Build_11_Sprint_3.zip\CIF B11S3\VA.PPMS.DataWebService\VA.PPMS.DataWebService\PpmsDataWebService\App_Start | SwaggerConfig.cs | Thu May 16 16:27:54 2019 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 6 | 602 |
| Changed | 5 | 10 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | using Syst em.Web.Htt p; | |
| 2 | using WebA ctivatorEx ; | |
| 3 | using Ppms DataWebSer vice; | |
| 4 | using Swas hbuckle.OD ata; | |
| 5 | using Swas hbuckle.Ap plication; | |
| 6 | using Syst em.Web.Htt p.Descript ion; | |
| 7 | using Syst em.Web.Htt p.Routing. Constraint s; | |
| 8 | using Syst em.Linq; | |
| 9 | using Syst em.Configu ration; | |
| 10 | using Syst em; | |
| 11 | using Syst em.Web.UI. WebControl s; | |
| 12 | ||
| 13 | [assembly: PreApplic ationStart Method(typ eof(Swagge rConfig), "Register" )] | |
| 14 | ||
| 15 | namespace PpmsDataWe bService | |
| 16 | { | |
| 17 | public class Swa ggerConfig | |
| 18 | { | |
| 19 | pu blic stati c void Reg ister() | |
| 20 | { | |
| 21 | var this Assembly = typeof(Sw aggerConfi g).Assembl y; | |
| 22 | ||
| 23 | GlobalCo nfiguratio n.Configur ation | |
| 24 | .Ena bleSwagger (c => | |
| 25 | { | |
| 26 | ||
| 27 | // By default, t he service root url is inferre d from the request u sed to acc ess the do cs. | |
| 28 | // How ever, ther e may be s ituations (e.g. prox y and load -balanced environmen ts) where this does not | |
| 29 | // res olve corre ctly. You can workar ound this by providi ng your ow n code to determine the root U RL. | |
| 30 | // | |
| 31 | //c.Ro otUrl(req => GetRoot UrlFromApp Config()); | |
| 32 | ||
| 33 | // If schemes ar e not expl icitly pro vided in a Swagger 2 .0 documen t, then th e scheme u sed to acc ess | |
| 34 | // the docs is t aken as th e default. If your A PI support s multiple schemes a nd you wan t to be ex plicit | |
| 35 | // abo ut them, y ou can use the "Sche mes" optio n as shown below. | |
| 36 | // | |
| 37 | //c.Sc hemes(new[ ] { "http" , "https" }); | |
| 38 | ||
| 39 | // Use "SingleAp iVersion" to describ e a single version A PI. Swagge r 2.0 incl udes an "I nfo" objec t to | |
| 40 | // hol d addition al metadat a for an A PI. Versio n and titl e are requ ired but y ou can als o provide | |
| 41 | // add itional fi elds by ch aining met hods off S ingleApiVe rsion. | |
| 42 | // | |
| 43 | ||
| 44 | string endPointN ame = Conf igurationM anager.App Settings[" Connection Name"]; | |
| 45 | string metadataL ink = ""; | |
| 46 | switch (endPoint Name) | |
| 47 | { | |
| 48 | ca se "DEV": | |
| 49 | metadataLi nk = Strin g.Format(" <a href=\' https:// DNS . URL /v1.0/$met adata'>Met adata</a>" ); | |
| 50 | break; | |
| 51 | ca se "NON-PR OD": | |
| 52 | metadataLi nk = Strin g.Format(" <a href=\' https:// DNS . URL /v1.0/$met adata'>Met adata</a>" ); | |
| 53 | break; | |
| 54 | ca se "PROD": | |
| 55 | metadataLi nk = Strin g.Format(" <a href=\' https:// DNS . URLL /v1.0/$met adata'>Met adata</a>" ); | |
| 56 | break; | |
| 57 | de fault: | |
| 58 | metadataLi nk = Strin g.Format(" <a href=\' https:// DNS . URL /v1.0/$met adata'>Met adata</a>" ); | |
| 59 | break; | |
| 60 | } | |
| 61 | ||
| 62 | string dws SharePoint Link = Str ing.Format ("<a href= \'https:// URL /pm/iehr/v ista_evolu tion/RA/CC P_PPMS/PPM S_DWS/Site Pages/Home .aspx'>Sha rePoint Fo rum</a>"); | |
| 63 | string versionNu mber = "1. 0"; | |
| 64 | string title = s tring.Form at("PPMS D ata Web Se rvice {0} {1}", endP ointName, versionNum ber); | |
| 65 | string descripti on = strin g.Format(" {0} {1} {2 }", metada taLink, dw sSharePoin tLink, Dat eTime.Now. ToString(" yyyy-MM-dd ")); | |
| 66 | ||
| 67 | c.Sing leApiVersi on("v1", t itle).Cont act(d => d .Name("Mic rosoft") | |
| 68 | .Email ("jowhitfi @microsoft .com; ayot t@microsof t.com")) | |
| 69 | .Descripti on(descrip tion); | |
| 70 | ||
| 71 | ||
| 72 | // If you want t he output Swagger do cs to be i ndented pr operly, en able the " PrettyPrin t" option. | |
| 73 | // | |
| 74 | //c.Pr ettyPrint( ); | |
| 75 | ||
| 76 | // If your API h as multipl e versions , use "Mul tipleApiVe rsions" in stead of " SingleApiV ersion". | |
| 77 | // In this case, you must provide a lambda tha t tells Sw ashbuckle which acti ons should be | |
| 78 | // inc luded in t he docs fo r a given API versio n. Like "S ingleApiVe rsion", ea ch call to "Version" | |
| 79 | // ret urns an "I nfo" build er so you can provid e addition al metadat a per API version. | |
| 80 | // | |
| 81 | //c.Mu ltipleApiV ersions( | |
| 82 | // (apiDesc, targetApiV ersion) => ResolveVe rsionSuppo rtByRouteC onstraint( apiDesc, t argetApiVe rsion), | |
| 83 | // (vc) => | |
| 84 | // { | |
| 85 | // //vc.V ersion("v2 ", "Swashb uckle Dumm y API V2") ; | |
| 86 | // vc.Ver sion("v1", "PpmsData WebService V1"); | |
| 87 | // }); | |
| 88 | ||
| 89 | // You can use " BasicAuth" , "ApiKey" or "OAuth 2" options to descri be securit y schemes for the AP I. | |
| 90 | // See https://g ithub.com/ swagger-ap i/swagger- spec/blob/ master/ver sions/2.0. md for mor e details. | |
| 91 | // NOT E: These o nly define the schem es and nee d to be co upled with a corresp onding "se curity" pr operty | |
| 92 | // at the docume nt or oper ation leve l to indic ate which schemes ar e required for an op eration. T o do this, | |
| 93 | // you 'll need t o implemen t a custom IDocument Filter and /or IOpera tionFilter to set th ese proper ties | |
| 94 | // acc ording to your speci fic author ization im plementati on | |
| 95 | // | |
| 96 | //c.Ba sicAuth("b asic") | |
| 97 | // .Descripti on("Basic HTTP Authe ntication" ); | |
| 98 | // | |
| 99 | // NOT E: You mus t also con figure 'En ableApiKey Support' b elow in th e SwaggerU I section | |
| 100 | //c.Ap iKey("apiK ey") | |
| 101 | // .Descripti on("API Ke y Authenti cation") | |
| 102 | // .Name("api Key") | |
| 103 | // .In("heade r"); | |
| 104 | // | |
| 105 | //c.OA uth2("oaut h2") | |
| 106 | // .Descripti on("OAuth2 Implicit Grant") | |
| 107 | // .Flow("imp licit") | |
| 108 | // .Authoriza tionUrl("h ttp://pets tore.swagg er.wordnik .com/api/o auth/dialo g") | |
| 109 | // //.TokenUr l("https:/ /tempuri.o rg/token") | |
| 110 | // .Scopes(sc opes => | |
| 111 | // { | |
| 112 | // scopes .Add("read ", "Read a ccess to p rotected r esources") ; | |
| 113 | // scopes .Add("writ e", "Write access to protected resources "); | |
| 114 | // }); | |
| 115 | ||
| 116 | // Set this flag to omit d escription s for any actions de corated wi th the Obs olete attr ibute | |
| 117 | //c.Ig noreObsole teActions( ); | |
| 118 | ||
| 119 | // Eac h operatio n be assig ned one or more tags which are then used by consum ers for va rious reas ons. | |
| 120 | // For example, the swagge r-ui group s operatio ns accordi ng to the first tag of each op eration. | |
| 121 | // By default, t his will b e controll er name bu t you can use the "G roupAction sBy" optio n to | |
| 122 | // ove rride with any value . | |
| 123 | // | |
| 124 | //c.Gr oupActions By(apiDesc => apiDes c.HttpMeth od.ToStrin g()); | |
| 125 | ||
| 126 | // You can also specify a custom sor t order fo r groups ( as defined by "Group ActionsBy" ) to dicta te | |
| 127 | // the order in which oper ations are listed. F or example , if the d efault gro uping is i n place | |
| 128 | // (co ntroller n ame) and y ou specify a descend ing alphab etic sort order, the n actions from a | |
| 129 | // Pro ductsContr oller will be listed before th ose from a Customers Controller . This is typically | |
| 130 | // use d to custo mize the o rder of gr oupings in the swagg er-ui. | |
| 131 | // | |
| 132 | //c.Or derActionG roupsBy(ne w Descendi ngAlphabet icComparer ()); | |
| 133 | ||
| 134 | // If you annota te Control lers and A PI Types w ith | |
| 135 | // Xml comments (http://ms dn.microso ft.com/en- us/library /b2s063f7( v=vs.110). aspx), you can incor porate | |
| 136 | // tho se comment s into the generated docs and UI. You ca n enable t his by pro viding the path to o ne or | |
| 137 | // mor e Xml comm ent files. | |
| 138 | // | |
| 139 | //c.In cludeXmlCo mments(Get XmlComment sPath()); | |
| 140 | ||
| 141 | // Swa shbuckle m akes a bes t attempt at generat ing Swagge r complian t JSON sch emas for t he various types | |
| 142 | // exp osed in yo ur API. Ho wever, the re may be occasions when more control of the outpu t is neede d. | |
| 143 | // Thi s is suppo rted throu gh the "Ma pType" and "SchemaFi lter" opti ons: | |
| 144 | // | |
| 145 | // Use the "MapT ype" optio n to overr ide the Sc hema gener ation for a specific type. | |
| 146 | // It should be noted that the resul ting Schem a will be placed "in line" for any applic able Opera tions. | |
| 147 | // Whi le Swagger 2.0 suppo rts inline definitio ns for "al l" Schema types, the swagger-u i tool doe s not. | |
| 148 | // It expects "c omplex" Sc hemas to b e defined separately and refer enced. For this reas on, you sh ould only | |
| 149 | // use the "MapT ype" optio n when the resulting Schema is a primiti ve or arra y type. If you need to alter a | |
| 150 | // com plex Schem a, use a S chema filt er. | |
| 151 | // | |
| 152 | //c.Ma pType<Prod uctType>(( ) => new S chema { ty pe = "inte ger", form at = "int3 2" }); | |
| 153 | ||
| 154 | // If you want t o post-mod ify "compl ex" Schema s once the y've been generated, across th e board or for a | |
| 155 | // spe cific type , you can wire up on e or more Schema fil ters. | |
| 156 | // | |
| 157 | //c.Sc hemaFilter <ApplySche maVendorEx tensions>( ); | |
| 158 | ||
| 159 | // In a Swagger 2.0 docume nt, comple x types ar e typicall y declared globally and refere nced by un ique | |
| 160 | // Sch ema Id. By default, Swashbuckl e does NOT use the f ull type n ame in Sch ema Ids. I n most cas es, this | |
| 161 | // wor ks well be cause it p revents th e "impleme ntation de tail" of t ype namesp aces from leaking in to your | |
| 162 | // Swa gger docs and UI. Ho wever, if you have m ultiple ty pes in you r API with the same class name , you'll | |
| 163 | // nee d to opt o ut of this behavior to avoid S chema Id c onflicts. | |
| 164 | // | |
| 165 | //c.Us eFullTypeN ameInSchem aIds(); | |
| 166 | ||
| 167 | // Alt ernatively , you can provide yo ur own cus tom strate gy for inf erring Sch emaId's fo r | |
| 168 | // des cribing "c omplex" ty pes in you r API. | |
| 169 | // | |
| 170 | //c.Sc hemaId(t = > t.FullNa me.Contain s('`') ? t .FullName. Substring( 0, t.FullN ame.IndexO f('`')) : t.FullName ); | |
| 171 | ||
| 172 | // Set this flag to omit s chema prop erty descr iptions fo r any type propertie s decorate d with the | |
| 173 | // Obs olete attr ibute | |
| 174 | //c.Ig noreObsole teProperti es(); | |
| 175 | ||
| 176 | // In accordance with the built in J sonSeriali zer, Swash buckle wil l, by defa ult, descr ibe enums as integer s. | |
| 177 | // You can chang e the seri alizer beh avior by c onfiguring the Strin gToEnumCon verter glo bally or f or a given | |
| 178 | // enu m type. Sw ashbuckle will honor this chan ge out-of- the-box. H owever, if you use a different | |
| 179 | // app roach to s erialize e nums as st rings, you can also force Swas hbuckle to describe them as st rings. | |
| 180 | // | |
| 181 | //c.De scribeAllE numsAsStri ngs(); | |
| 182 | ||
| 183 | // Sim ilar to Sc hema filte rs, Swashb uckle also supports Operation and Docume nt filters : | |
| 184 | // | |
| 185 | // Pos t-modify O peration d escription s once the y've been generated by wiring up one or more | |
| 186 | // Ope ration fil ters. | |
| 187 | // | |
| 188 | //c.Op erationFil ter<AddDef aultRespon se>(); | |
| 189 | // | |
| 190 | // If you've def ined an OA uth2 flow as describ ed above, you could use a cust om filter | |
| 191 | // to inspect so me attribu te on each action an d infer wh ich (if an y) OAuth2 scopes are required | |
| 192 | // to execute th e operatio n | |
| 193 | // | |
| 194 | //c.Op erationFil ter<Assign OAuth2Secu rityRequir ements>(); | |
| 195 | ||
| 196 | // Pos t-modify t he entire Swagger do cument by wiring up one or mor e Document filters. | |
| 197 | // Thi s gives fu ll control to modify the final SwaggerDo cument. Yo u should h ave a good understan ding of | |
| 198 | // the Swagger 2 .0 spec. - https://g ithub.com/ swagger-ap i/swagger- spec/blob/ master/ver sions/2.0. md | |
| 199 | // bef ore using this optio n. | |
| 200 | // | |
| 201 | //c.Do cumentFilt er<ApplyDo cumentVend orExtensio ns>(); | |
| 202 | ||
| 203 | // In contrast t o WebApi, Swagger 2. 0 does not include t he query s tring comp onent when mapping a URL | |
| 204 | // to an action. As a resu lt, Swashb uckle will raise an exception if it enco unters mul tiple acti ons | |
| 205 | // wit h the same path (san s query st ring) and HTTP metho d. You can workaroun d this by providing a | |
| 206 | // cus tom strate gy to pick a winner or merge t he descrip tions for the purpos es of the Swagger do cs | |
| 207 | // | |
| 208 | c.Reso lveConflic tingAction s(apiDescr iptions => apiDescri ptions.Fir st()); | |
| 209 | ||
| 210 | // Wra p the defa ult Swagge rGenerator with addi tional beh avior (e.g . caching) or provid e an | |
| 211 | // alt ernative i mplementat ion for IS waggerProv ider with the Custom Provider o ption. | |
| 212 | // | |
| 213 | //c.Cu stomProvid er((defaul tProvider) => new Ca chingSwagg erProvider (defaultPr ovider)); | |
| 214 | c.Cust omProvider (defaultPr ovider => new ODataS waggerProv ider(defau ltProvider , c, Globa lConfigura tion.Confi guration)) ; | |
| 215 | }) | |
| 216 | .Ena bleSwagger Ui(c => | |
| 217 | { | |
| 218 | ||
| 219 | ||
| 220 | // Use the "Docu mentTitle" option to change th e Document title. | |
| 221 | // Ver y helpful when you h ave multip le Swagger pages ope n, to tell them apar t. | |
| 222 | // | |
| 223 | //c.Do cumentTitl e("My Swag ger UI"); | |
| 224 | ||
| 225 | // Use the "Inje ctStyleshe et" option to enrich the UI wi th one or more addit ional CSS stylesheet s. | |
| 226 | // The file must be includ ed in your project a s an "Embe dded Resou rce", and then the r esource's | |
| 227 | // "Lo gical Name " is passe d to the m ethod as s hown below . | |
| 228 | // | |
| 229 | //c.In jectStyles heet(conta iningAssem bly, "Swas hbuckle.Du mmy.Swagge rExtension s.testStyl es1.css"); | |
| 230 | ||
| 231 | // Use the "Inje ctJavaScri pt" option to invoke one or mo re custom JavaScript s after th e swagger- ui | |
| 232 | // has loaded. T he file mu st be incl uded in yo ur project as an "Em bedded Res ource", an d then the resource' s | |
| 233 | // "Lo gical Name " is passe d to the m ethod as s hown above . | |
| 234 | // | |
| 235 | //c.In jectJavaSc ript(thisA ssembly, " Swashbuckl e.Dummy.Sw aggerExten sions.test Script1.js "); | |
| 236 | ||
| 237 | // The swagger-u i renders boolean da ta types a s a dropdo wn. By def ault, it p rovides "t rue" and " false" | |
| 238 | // str ings as th e possible choices. You can us e this opt ion to cha nge these to somethi ng else, | |
| 239 | // for example 0 and 1. | |
| 240 | // | |
| 241 | //c.Bo oleanValue s(new[] { "0", "1" } ); | |
| 242 | ||
| 243 | // By default, s wagger-ui will valid ate specs against sw agger.io's online va lidator an d display the result | |
| 244 | // in a badge at the botto m of the p age. Use t hese optio ns to set a differen t validato r URL or t o disable the | |
| 245 | // fea ture entir ely. | |
| 246 | //c.Se tValidator Url("http: //localhos t/validato r"); | |
| 247 | //c.Di sableValid ator(); | |
| 248 | ||
| 249 | // Use this opti on to cont rol how th e Operatio n listing is display ed. | |
| 250 | // It can be set to "None" (default) , "List" ( shows oper ations for each reso urce), | |
| 251 | // or "Full" (fu lly expand ed: shows operations and their details). | |
| 252 | // | |
| 253 | //c.Do cExpansion (DocExpans ion.List); | |
| 254 | ||
| 255 | // Spe cify which HTTP oper ations wil l have the 'Try it o ut!' optio n. An empt y paramter list disa bles | |
| 256 | // it for all op erations. | |
| 257 | // | |
| 258 | //c.Su pportedSub mitMethods ("GET", "H EAD"); | |
| 259 | ||
| 260 | // Use the Custo mAsset opt ion to pro vide your own versio n of asset s used in the swagge r-ui. | |
| 261 | // It' s typicall y used to instruct S washbuckle to return your vers ion instea d of the d efault | |
| 262 | // whe n a reques t is made for "index .html". As with all custom con tent, the file must be include d | |
| 263 | // in your proje ct as an " Embedded R esource", and then t he resourc e's "Logic al Name" i s passed t o | |
| 264 | // the method as shown bel ow. | |
| 265 | // | |
| 266 | //c.Cu stomAsset( "index", c ontainingA ssembly, " YourWebApi Project.Sw aggerExten sions.inde x.html"); | |
| 267 | ||
| 268 | // If your API h as multipl e versions and you'v e applied the Multip leApiVersi ons settin g | |
| 269 | // as described above, you can also enable a s elect box in the swa gger-ui, t hat displa ys | |
| 270 | // a d iscovery U RL for eac h version. This prov ides a con venient wa y for user s to brows e document ation | |
| 271 | // for different API versi ons. | |
| 272 | // | |
| 273 | //c.En ableDiscov eryUrlSele ctor(); | |
| 274 | ||
| 275 | // If your API s upports th e OAuth2 I mplicit fl ow, and yo u've descr ibed it co rrectly, a ccording t o | |
| 276 | // the Swagger 2 .0 specifi cation, yo u can enab le UI supp ort as sho wn below. | |
| 277 | // | |
| 278 | //c.En ableOAuth2 Support( | |
| 279 | // clientId: "test-clie nt-id", | |
| 280 | // clientSecr et: null, | |
| 281 | // realm: "te st-realm", | |
| 282 | // appName: " Swagger UI " | |
| 283 | // //addition alQueryStr ingParams: new Dicti onary<stri ng, string >() { { "f oo", "bar" } } | |
| 284 | //); | |
| 285 | ||
| 286 | // If your API s upports Ap iKey, you can overri de the def ault value s. | |
| 287 | // "ap iKeyIn" ca n either b e "query" or "header " | |
| 288 | // | |
| 289 | //c.En ableApiKey Support("a piKey", "h eader"); | |
| 290 | }); | |
| 291 | ||
| 292 | ||
| 293 | } | |
| 294 | ||
| 295 | pu blic stati c bool Res olveVersio nSupportBy RouteConst raint(ApiD escription apiDesc, string tar getApiVers ion) | |
| 296 | { | |
| 297 | var vers ionConstra int = (api Desc.Route .Constrain ts.Contain sKey("apiV ersion")) | |
| 298 | ? ap iDesc.Rout e.Constrai nts["apiVe rsion"] as RegexRout eConstrain t | |
| 299 | : nu ll; | |
| 300 | ||
| 301 | return ( versionCon straint == null) | |
| 302 | ? fa lse | |
| 303 | : ve rsionConst raint.Patt ern.Split( '|').Conta ins(target ApiVersion ); | |
| 304 | } | |
| 305 | } | |
| 306 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.