How can I generate a C# SDK from an OpenAPI - c#

Hi I'm using App Center for logging - they've got a web UI and also an API which looks to be OpenApi:
https://openapi.appcenter.ms/
How would I generate a C# SDK from this? I've tried using NSwagStudio
System.InvalidOperationException: The properties 'id', 'name' are defined multiple times.
Not sure why that would be the case because the webpage is showing this as a valid OpenApi spec

You might want to have a look at microsoft/kiota

Related

Valid Azure Blob Metadata Identifiers

I've been trying to add metadata on an .mp4 video that is stored on an Azure Blob. I want to add opengraph tags and when I try and enter them in, I get a message that says, "The name: 'og:type' should be a valid C# identifier." I'm not a C# developer and haven't been able to find documentation that shows valid C# identifiers for meta tags. Any help would be appreciated, thanks!
Edit: I must've misunderstood the purpose of the Metadata section as I thought it would add HTML meta tags to the document on the video's page. Do you know if this is possible? For example I want to share the link to this video on a social media site and would like to try and get this video to be able to play inline or have at least an image preview when sharing the link to the video
Adding metadata to existing Azure blobs will only work if you give valid input.
Please note that:
Beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers
As mentioned by #Stefan Wuebbe , you can find C# naming rules and conventions by following this document:
C# identifier names | Microsoft Docs
I tried in my environment and got the same error if I use colon (:) in the middle of metadata name.
To resolve the error, make use of underscore (_) instead of colon (:) like below:
To know more in detail, please refer below link:
Setting and retrieving properties and metadata for Blob service resources (REST API) - Azure Storage | Microsoft Docs

Swashbuckle Swagger - Refused to execute inline script because it violates the following Content Security Policy directive

I've added a CSP header (using custom middleware) to the response of Web API. Unfortunately, it broke a Swagger UI which is generated by Swashbuckle Nuget v5.6.0. The problem is in generated index.html which contains inline js script which violates CSP.
Is there any way to fix it without changing header values? I would like to stick to the current policy.
I found some opened/closed issues on GitHub project page but I didn't find any solution yet.
The problem is in generated index.html which contains inline js script which violates CSP.
Is there any way to fix it without changing header values? I would like to stick to the current policy.
Obviously, there is only one way - to remove all inline scripts into external files.
And you did not show your CSP header, may be it contaits 'nonce-value' so you can use it to allow some kinds of inline scripts.

Customize SwaggerDocument generation

I've written an ASP.NET application that dynamically generates a RESTful web service based on a script. There's a root controller (/dataserver) and everything after that depends on the script. The script allows you to specify custom handlers, for example handlers to get data from a database.
Because of this the structure of the api isn't fixed. There's only one controller. I'm using Swashbuckle.AspNet.Core and when it runs it only build a swagger document for that controller. What I'd like to do is intercept the generation of the swagger document so that I can add the structure of the web service into the document.
I've spent some time looking at Swashbuckle but I can't work out how to hook into the document generation so that I can populate. Can anyone point me in the right direction?
Something like that the only option I see is to use an IDocumentFilter to modify the resulting document.
There are a few examples on the repo:
https://github.com/domaindrivendev/Swashbuckle.AspNetCore/blob/b64b8fd6fbc7959849445be676f5e3d4a8e947bf/test/Swashbuckle.AspNetCore.SwaggerGen.Test/Fixtures/Extensions/VendorExtensionsDocumentFilter.cs
https://github.com/domaindrivendev/Swashbuckle.AspNetCore/blob/e2f30e04f412b821a5a989338a186e422c776cc4/src/Swashbuckle.AspNetCore.Annotations/AnnotationsDocumentFilter.cs
https://github.com/domaindrivendev/Swashbuckle.AspNetCore/blob/b64b8fd6fbc7959849445be676f5e3d4a8e947bf/src/Swashbuckle.AspNetCore.SwaggerGen/XmlComments/XmlCommentsDocumentFilter.cs
I'm afraid that those examples are too simple for what you are trying to accomplish...
but hopefully, they give you a push in the right direction

What should I do if I would like to convert such a php system to C#?

I have been developing a php web system for my project and I have completed the PHP v system however, my lecturer refuse to mark it and say that I should use C# with web matrix instead of php and MySQL with dreamweaver. Now That i have completed the assignment but in a different format I would like to ask if there is any way to do changes to the scripts instead of redoing the whole project.
Another thing is that in my PHP system, I have pages like:
login.php > login_now.php > home.php
where login_now.php is the processor page.
Does C# allows me to have a processor page similar to this as well?
If don't mind can someone advice me on what I should do? Thanks so much...I am lost.
Your only option is to rewrite the application from the ground up. The migration assistant mentioned by Luxspes is virtually useless as it was written for .NET v 1.1 (Web Forms), whereas the Web Pages framework runs on v 4.0.
You can use "processor" pages in Web Pages in the same way as you have in PHP, but my preference would be house the processing logic in the same page as the form and then redirect on success using the Post - Redirect - Get pattern (PRG), regardless of whether I was using PHP or ASP.NET.
If what to you need is to make it run on .NET, you could use PHP .NET Compiler: Phalanger: http://www.php-compiler.net/
If you want to actually translate the code you could use this: http://www.asp.net/downloads/archived-v11/migration-assistants/php-to-aspnet

OpenSearch .net (C#) library: which one?

i would like to add OpenSearch to my C# webapplication.
does someone recommend a certain .net library? or does a custom webapplication require a tailormade opensearch implementation?
That might help:
http://blog.unto.net/opensearch/add-opensearch-to-your-site-in-five-minutes/
If you want while-you-type suggestions, you need to have a search method on the server that searches and returns the results in JSON (not XML) format. If you don't need suggestions, you just need a method that responds to the search in a normal way by pushing HTML to the browser.
Have a look at Mozilla's official documentation for creating an opensearch plugin for your site and supporting search suggestions
I suggest OpenSearch.Net (an open source fork of elasticsearch-net).
Have a look into the git repo for getting started
https://github.com/opensearch-project/opensearch-net

Categories

Resources