I'm working on a Golang project at the moment. As a framework, I use go-fibre. To implement swagger documentation, I utilize swaggo/swag and fibre-swagger. I need to modify my swagger output page (eg: Font size should be increased, colour should be changed, the logo should be removed. etc..). Therefore, in Golang, how do I apply custom CSS for Swagger?
Thanks.
Related
I have a web API created in ASP.NET (.NET 4.6.2) and I need to implement Swagger UI into it.
Unfortunately, the API is created in such a way that it works with query parameters and method overloading, which both pose a significant problem to the auto-generated Swagger UI. Rather than go through the fairly complicated process of ResolveConflictingActions and/or using XML documentation to unknown effect, I would much prefer writing up a custom YAML file and have my project use that. However, so far, I have not been able to find a way to make Swashbuckle accept a custom one.
Tried adding the YAML file as a custom asset in SwaggerConfig.cs
The project seems to have accepted the file - no build errors, the UI reports no errors either but still uses the autogenerated structure.
I am using in my Nativescript Angular app the nativescript-google-maps-sdk plugin which works great.
My issue is that I want to use cached images to display in a custom InfoWindow. For this purpose I am using the nativescript-web-image-cache plugin app-wide. When I use the regular <WebImage> tag in the infoWindow it complains that it is not a registered component:
Module 'ui/web-image' not found for element 'WebImage'
Everywhere else in the app it works just fine. In this issue is it suggested that:
that InfoWindowTemplate content is parsed as Vanilla NativeScript XML, not as Angular XML thus it is not able to find custom Angular Component you created
So the question is how can I still use this plugin? Is there a way I can somehow register the <WebImage> component so it will work in the custom InfoWindow?
Just to make sure there is not another issue, I added the nativescript-web-image-cache plugin to the plain NativesScript nativescript-google-maps-sdk demo project and then the <WebImage> tag works just fine.
Any pointers are highly appreciated!
Anything registered in Angular is not available in Core the same way; so if you have to create a core template; you must also pass in the xmlns:blah="ns-blah" as part of the core template, so that it is registered properly in that core template. The angular registerElement does not do anything for Core. Now you can easily do <IC:WebImage xmlns:IC="nativescript-web-image-cache" ...> and then it is valid in the template. However, I would recommend you put the xmlns:IC on the topmost element you can; as it makes reading the code a lot simpler. But in cases you don't have a parent wrapping element around the item, this is valid code to register it on the same element using it.
NS-Core templates are different than NS-Angular templates; if you attempt to use things that work in Angular like <IC:WebImage [param]="value" (param)="value"/> both the [param] and (param) will totally break template parsing in core. NS-Core's parser is like HTML, nothing is supposed to surround the param and the value should be in quotes. The value can have {{ boundvalue }} to bind a dynamic value into the template.
Normally when passing a NS-Core template into whatever function you need; you want to pass in just the minimal parts; you rarely need to use things like <Page>, <Frame> or any other top level elements. In fact this can cause problems. You normally need just the piece of the layout you are going to have it view. So in this case <StackLayout xmlns:IC=...><IC:WebImage...></StackLayout>
Finally when troubleshooting using Core features in Angular; I highly recommend you put fixed Width/Height and Background colors on each element. This can sometimes show you what is failing.
As InfoWindowTemplate content is parsed as Vanilla NativeScript XML, you could add xmlns:IC="nativescript-web-image-cache" to the root / parent element of your component. Also use <IC:WebImage> instead of WebImage.
I've been using NativeScript for a while in some projects. One think I noticed is that "default" NativeScript directives, such as nsRouterLink, tap and some others does not work with components that I created.
The only times those directives works are when they are using with its default" components such as GridLayout, Label, etc.
I've created a small PlayGround project to demonstrate my issue: https://play.nativescript.org/?template=play-ng&id=rZYQGP&v=3
I think I should import those directives into my custom components somehow, but I have no idea how.
Unfortunately it's not as same as Web with NativeScript, you have to attach the events to the actual element and not on the custom selectors. An alternative is that you can emit an event on your custom component when actual element is tapped.
There is a open feature request already.
I'm no expert but I had same issue recently and could make workaround.
NativeScript's pure component should be registered appropriate
ly on Angular environment to work properly.
This can be done with registerElement from nativescript-angular/element-registry.
By registering, the Angular Component should work like intended element.
Unfortunately, the property of the element can only be accessed with HostBinding
I have forked and applied workaround to PlayGround project you have provided: https://play.nativescript.org/?template=play-ng&id=SCLxVk
I am looking at ASP.NET Boilerplate as a possible framework. Many of the features seem to be exactly what I need, but I need implementation details for one of the feature to see if will work for my application.
On the feature page for Zero here: https://www.aspnetzero.com/#features
there is a feature called: "Custom tenant logo and CSS support"
I cannot find how this is implemented anywhere in the documentation. How exactly does this feature work?
Create a demo on https://www.aspnetzero.com then login as admin and go to the settings page (Appearance tab). You can load a CSS or logo here.
To test CSS, create a file, say custom.css, add the contents below and save the file:
.page-header.navbar.navbar-fixed-top {
background-color:red;
}
Then select and upload the file from "Custom CSS" area. You will see that page header's background becomes red:
This was a very simple example. You can completely customize UI with a custom CSS.
If you are asking for the implementation, the code is the best thing that explains it. If you buy AspNet Zero then you will get source code.
BTW, it would be better to send emails to info#aspnetzero.com for your pre-sale questions rather than asking on SO.
Does anyone know how to customise the rendering of the MVC sitemap provider so my ul element has a specific css class?
Try MvcSiteMapProvider hosted on CodePlex. You should be able to fairly easily migrate your existing Sitemap file to the slightly different but essentially compatible format. This will give you the ability to output your sitemap using the simple Html.MvcSiteMap().SiteMap() helper method.
The source of the project includes the default templates which you can edit to produce any rendering you like...or just pass in the name of a template in accordance with MVC convention. The model types you'll be rendering are SiteMapHelperModel, SiteMapNodeModel and SiteMapNodeModelList (namespaces removed for terseness).
I appreciate this may not be exactly what you're after as it relies on a 3rd party tool but its a useful project that supports much more than just rendering sitemaps. You'll want version 3.0.0 for MVC3.
Dan