I'm self-hosting Swagger documentation for my Web API 2 API with Swashbuckle.Core 5.6.0
I'm enabling Swagger in my Startup.cs as follows
config.EnableSwagger(c =>
{
c.SingleApiVersion("v1", "AUDM API");
c.IncludeXmlComments(AppDomain.CurrentDomain.BaseDirectory + "commentsfile1.xml");
c.IncludeXmlComments(AppDomain.CurrentDomain.BaseDirectory + "commentsfile2.xml");
c.DescribeAllEnumsAsStrings();
}).EnableSwaggerUi(/*x => x.DisableValidator()*/);
The swagger ui shows up just fine, listing all my endpoints and methods. But, there's zero documentation.. all my comments and remarks in the controllers are missing, as are the
When I debug and look at the two fully qualified paths to my XML files, they resolve just fine at runtime, so I'm assuming that should be fine.
The two xml files come from different libraries, but that shouldn't matter, should it.. the files are there so IMHO they should be used. Is there a way to troubleshoot why the XML files are not getting picked up?
I think that you might be missing a slash \ in the path, try this:
c.IncludeXmlComments(AppDomain.CurrentDomain.BaseDirectory + "\commentsfile1.xml");
here is a sample from the official project:
https://github.com/domaindrivendev/Swashbuckle/blob/5489aca0d2dd7946f5569341f621f581720d4634/Swashbuckle.Dummy.Core/App_Start/SwaggerConfig.cs#L261
Related
I would like to tell to ASP.NET Core application that even if appsettings.json file is there - ignore it.
I would prefer to write this as a comment but I'm still a newby here so I cannot ask questions.
I would like to understand what is the specific problem you are facing right now.
In general the usage or not of the appsettings file depends on your application.
For example, if you create a Web API using default .NET template, you can see that the appsettings file only has some configuration for logging, which you can even delete and nothing happens. You can run the application anyway and it works.
So, coming back to your question, it dependes on what your application is doing. If you have a specific library that needs to read configuration from this file, then you'll need to research how to change that default value.
If you are reading from that file, then you could set value in code instead. (this is obvious but since you didn't provide any more context I don't know what you are struggling with)
I have a problem with angular translates useSanitizeValueStrategy.
It does nothing regardless what configuration i use.
I am using the async loader to load my translations.
It is an ASP.net MVC web api project.
Things I did to make it work :
implemented ngSanitize
tried multiple configurations
$translateProvider.useUrlLoader('api', {
queryParameter: 'langId'
})
.registerAvailableLanguageKeys(['en', 'de'])
.preferredLanguage('en')
.fallbackLanguage('de')
.useSanitizeValueStrategy('escape'); // tried every configuration I found
I also tried to seperate the useSanitizeValueStrategy like $translateProvider.useSanitizeValueStrategy('escape');
or tried to change the position of the command but this did not work either.
any suggestions why this does not work?
$translateProvider.useSanitizeValueStrategy('escape');
Try above-given line into your application configuration where you configuring your angular-translate library. In above given an answer with Strategy escape. This will escape HTML in the translation. You can also find many options here.
I have an existing FineUploader implementation for small files using the Traditional (upload-to-server) version which is working great. However, I'd like to also allow Direct S3 uploads from a different part of the application which deals with large attachments, without rewriting the existing code for small files.
Is there some way to allow both Direct S3 and Traditional uploads to work alongside each other? This is a single-page application, so I can't just load one or the other fine-uploader versions depending on which page I'm on.
I tried just including both fine-uploader JS files, but it seemed to break my existing code.
Client-side code:
$uploadContainer = this.$('.uploader')
$uploadButton = this.$('.upload-button')
$uploadContainer.fineUploader(
request:
endpoint: #uploadUrl
inputName: #inputName
params:
authenticity_token: $('meta[name="csrf-token"]').attr('content')
button: $uploadButton
).on 'complete', (event, id, fileName, response) =>
#get('controller').receiveUpload(response)
Good find, #Melinda.
Fine Uploader lives within a custom-named namespace so that it does not conflict with other potential global variables, this is the qq namespace (historically named). What is happening is that each custom build is redeclaring this namespace along with all member objects when you include it in the <script> tags on your page.
I've opened up an issue on our bug tracker that explains the issue in more technical details, and we're looking to prioritize a fix to the customize page so that in the future no one will have this issue.
I've been looking at using Aloha for a project but I'm completely stumped by the documentation. I'm trying to create a repository following the documentation and I have this so far:
requirejs.config({
paths: {
'jquery': "http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min",
'aloha': "http://cdn.aloha-editor.org/latest/lib/aloha",
},
});
define(
['jquery'],
function($) {
"use strict";
require(['aloha'], function(localAloha) {
console.debug(localAloha);
console.debug(Aloha.AbstractRepository);
});
return {};
}
);
Now. This tries to pull Aloha and jQuery from an appropriate CDN, and it works fine. However, despite what the Aloha documentation tells me, localAloha is not defined (it appears Aloha doesn't return itself) but that's not a problem since my that point it's in the global namespace anyway.
More frustrating when trying to define a repository is the fact that Aloha.AbstractRepository is undefined, despite all the examples, and code from live projects like the Drupal Aloha plugin, telling that all I need to do is extend Aloha.AbstractRepository.
Does anyone have any idea what's going on here? Aloha looks great, and is perfect for what I have in mind, but it's proven to be very difficult to actually get it working.
here is some code which should help you.
a php script is reading files from direcotries (eg. upload dir) and generates a json file with that information. that json is in the format which can be used by a js file (repository api) to tell aloha editor what's in your repository: http://ge.tt/1VJqium/v/0?c
I want to query my CCNet server to find out the status of the builds. I've heard rumor that there's a (ReST?) API of sorts, but I can't seem to find any documentation for it.
Is there any documentation for it, or do I need to download the CCNet source code and start reading?
EDIT: I found the endpoint /XmlStatusReport.aspx, which gives an XML overview of all projects. The same filename in any folder gives exactly the same response, though, so I'm afraid that might be the only API there is.
As an alternative to the XML you already mentioned yourself, you could use remoting as the CCTray app does. If you reference ThoughtWorks.CruiseControl.Remote.dll form the CruiseControl.NET\server folder you can instantiate CruiseServerRemotingClient and use it to retrieve information from the server.
The following snippet prints out the list of projects on the server and their build statuses:
CruiseServerRemotingClient client = new CruiseServerRemotingClient("tcp://ccnetserver:21234/CruiseManager.rem");
ProjectStatus[] statusList = client.GetProjectStatus();
foreach (ProjectStatus status in statusList)
{
Console.WriteLine("{0}: {1}", status.Name, status.BuildStatus);
}
You could also retrieve the log for the latest build in XML format as follows:
string buildName = client.GetLatestBuildName("Jasenje");
Console.WriteLine(client.GetLog("Jasenje", buildName));
I haven't managed to find any real documentation for the API but at least there are XML comments with brief descriptions of methods and parameters.