Can swashbuckle serialize one swagger document as v2 but the others as v3? - sdk

According to the documentation Here setting the SerializeAsV2 option can render all of your swagger documents as v2.
Because there are some tools we use to generate SDKs, one of which is having issues with generating against openapi3 (but works with v2) so for a short term fix I was hoping to be able to render a singular document as v2 and leave the others defaulting to openapi3.
Has anyone had any experience trying to do something like this?

Related

Swagger-UI how much modification can be done

I have some questions regarding swagger-ui. I have downloaded the swagger-ui from here and have played around with the index.html and tried modifying it. From what I understand the UI is dynamically generated based on the open api specification doc either in a yaml or json file format. My questions are as follows
How much modification can be done to the UI that is being generated by the Swagger?
Can "Try Out" functionality be modified to have more control? What I want to do is have few input fields which are not generated by swagger and use them as input for an api call, make UI more dynamic in nature.
Does the Swagger-UI depend on any sort of API gateway to make calls to api endpoints?
Thanks,
Salil
How much modification can be done to the UI that is being generated by the Swagger?
Swagger UI can be tweaked in very different ways mainly via JS or CSS.
You can have a look to https://swagger.io/docs/open-source-tools/swagger-ui/customization/overview/
Can "Try Out" functionality be modified to have more control? What I want to do is have few input fields which are not generated by swagger and use them as input for an api call, make UI more dynamic in nature.
You should have a look to the link I shared above but not sure this is doable like this.
If I had to do such kind of thing I would rather look at how to complete the original OpenAPI definition (the yaml/JSON file) before passing it to Swagger UI.
Note that there is also a "interceptor" feature in Swagger UI that allow to modify requests before sending them for instance. This might interest you.
Does the Swagger-UI depend on any sort of API gateway to make calls to api endpoints?
Not at all. Swagger UI just uses your browser to call the API at the URL documented by the OpenAPI file.
Stack Overflow doesn't work well when there are multiple questions as part of one "Question". Having said that, I'll answer what I know.
As far as I can tell, you can modify the yaml or JSON source as much as you like. You can write an entire file from scratch, or import it from any editor.
For this sort of testing, I think you might want to look for a more in-depth testing tool such as Postman. That's not something I have any experience with, but from what I hear it could help with "what if I send this request?" sceanrios.

Snipcart v3 and 'data-item-stackable' attribute

I'm banging my head against the wall with this for a month. Setting data-item-stackable="never" in Snipcart V3 does absolutely nothing for me.
But there's more weird things going on:
On my dashboard, I'm getting this message saying:
It seems you’re not using the latest version of our shopping cart.
Would you like to switch to the v3.0 ?
Needless to say, I'm using at my site the latest (at the time of writing this) snipcart.js v3.0.31. What is dashboard detecting as Snipcart v2? I've never used Snipcart v2 on the site in question and I didn't migrate from v2 to v3.
In Snipcart v3 documentation, it says that data-item-stackable attribute is enum type. However, in v3 migration guide, it is stated
The data-item-stackable attribute isn't boolean anymore, but a string
that describes the different possible behaviors
So is it a string or is it an enum?
I'd like to know if anyone else had an issue with correct version detecting and/or data-item-stackable doing absolutely nothing? Are those two just different manifestations of the same problem I'm having?
Has anyone succeeded in getting items "non-stacked" with Snipcart v3, without using Javascript SDK, as intended?
Thank you for your time and effort.
Cheers.
Just got the answer from nice guys at Snipcart. It seems that the problem is that data-item-stackable="never" is not working if data-item-quantity has been set on the snipcart button. Here's their answer:
Even if a product isn't stackable, if you specify the quantity on the
product, this value will be used as "default" value, this is why when
you click on the buy button it uses the value you set as quantity.
For your use case, I'd recommend adding the items programmatically,
please take a look at our JavaScript SDK documentation
They even provided a small example here:
https://codesandbox.io/s/crimson-tree-7tffo?file=/index.html

Implement search in Swagger UI

I got the question to implement search in my Swagger UI which uses localhost.
I have been searching online and I didn't find an answer for this.
My question is: "Is it possible to implement search in the Swagger UI, so people can search for a path of the API?"
Thanks in advance!
I have received an answer on the official Swagger community page on Google groups.
They suggested the following page on github and this was just what I was looking for. It is a very nice looking search implementation in the Swagger UI.
https://github.com/swagger-api/swagger-ui/pull/2116
Anyway thanks for answering to my question!
This swagger-ui don't have a ui-search option so far. But as a solution you have 2 options.
By default swagger-ui list down the set of apis based on the paths (annotated by #Api() on api code). In the below example it has listed down apis based on 2 paths (price-checks and pdp-details).
2.You can explicitly tell swagger-ui to only show apis listed under specific path. In below example, it shows apis listed under price-checks only.
To do that, you have to configure that path-doc with swagger.
Refer this for more info about swagger-annotations.
UPDATE:
In- built swagger-ui search is now available.
There is a repository in githubswagger search that can search API's across projects and search API in swagger document by command(ctrl)+F.

Swagger UI for messaging API

I'd like to know if the following is possible.
Swagger is almost what I need to document a Message based API. For instance for a Command Message I'd like to say "Command" instead of "Post", and instead of "path" I'd like to have the name of the Command.
The spec mentions that Vendor Extensions are possible using "x-" properties but I am 1) not finding any examples of how to do this and 2) not sure if the use of these properties would help me meet my goals.
Might anyone be able to point me to some resources that can help me move along?
Swagger is designed to document REST APIs which are based on HTTP verbs. You can't replace verbs or invent new ones.
Vendor extensions are there to allow adding additional information that the specification does not allow, but ultimately, it is still intended for REST APIs.
From what I gather, you're trying to describe something different.
We do welcome suggestions for additional roads for Swagger (that is, cover non-REST APIs), and in order to do that, I'd suggest opening an issue on the swagger-spec repository.

Lack of access to all functions in exposed interfaces?

I have a rather fundamental issue with coding in OpenOffice/LibreOffice Basic that I can't seem to figure out. I don't always have access to all the functions I'm supposed to. Here's an example:
Sub TestSub
Dim doc As Object
doc = ThisComponent 'Note that we're in LibreOffice Writer
MsgBox(doc.Text.Dbg_SupportedInterfaces)
doc.Text.finishParagraph(Array()) 'Works OK
doc.Text.appendParagraph(Array()) 'Error, property or method not found
End Sub
The doc.Text.Dbg_SupportedInterfaces property tells me that one of the interfaces that I am supposed to have access to is com.sun.star.text.XParagraphAppend, which is meant to expose both finishParagraph and appendParagraph, yet I only seem to have access to finishParagraph. Why is this? This isn't an isolated case - all over the place I see that I am meant to have access to functions that I don't have access to.
Openoffice and Libreoffice are different projects. That's why they will be developed different and they will become much more different in the future. With your example Libreoffice has no more appendParagraph but finishParagraphInsert. See: http://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1text_1_1XParagraphAppend.html
For BASIC development I recommend to use a debugging tool like XRAY. See: https://wiki.documentfoundation.org/Macros This tool will show only the properties and methods which are really there. Unfortunately there is even no more global index in API documentation of Libreoffice. So XRAY cannot link directly to the Libreoffice API documentation. Therefore at the moment I use the https://www.openoffice.org/api/docs/common/ref/index-files/index-1.html for both Openoffice and Libreoffice and check manually the Libreoffice API http://api.libreoffice.org/ if I am working on a macro for Libreoffice.

Resources