I have spring-boot/spring-mvc and springfox swagger2 integration. I have attached sample screen shot. In parameter type of 'body' I have a Model schema which describe elements data types. string, 0 etc! How can I replace it with actual example so that I can 'Try it out' . That would be more useful for my API consumer.
Not sure if you found the answer to this one, but I am going to answer this anyways.
The #ApiModelProperty has a property called example. You can make use of that.
#ApiModelProperty(value="name of the user", required=true, example="John")
Swagger
Related
We are trying to use Stardoc when generating documentation for our Bazel macros.
I can get a table generated with parameter descriptions when follow the instruction here:
Macro/Function documenatation.
But we would also like to add the parameter Type in the table.
According to DocstringUtils.java it seems like we shall write the type in parentheses after the parameter name but before colon, as this example:
another_parameter (unused, mutable): a parameter may be followed
by additional attributes in parenthese
I have seen that it's possible to add a rule template to the stardoc() rule (attribute: func_template).
I started to use an own copy of the default template to play around with: //stardoc:templates/markdown_tables/func.vm
If I have understood correctly it doesn't seem that the attributes that I add in paranthese is fetched.
And I don't think that I will be able to retreive that information by just updating the template.
So I think that it will need an update in the Stardoc code for this, correct?!
Is that something that is already planned?
If I'm not correct then I would appreciate information how I can retreive the value of the attribute.
Thanks!
Best Regards
Elisabeth
I have a spring boot application using spring data rest. I have a problem in providing a well read API documentation using swagger. I tried spring fox and springdoc, but each has its problems
Spring fox:
I can not change the tag name of a repository, only the description
No support for projections
No support of openAPI3 yet (this is actually not a big problem)
Springdoc (https://springdoc.org/)
I can not change neither the tag name nor the description (#Tag does not work on repos)
No support for projections
The same repo gets 3 tags e.g. books-entity-controller, books-search-controller (with methods of a parent class) and books-property-reference-controller (with unnecessary listing of /{id}/{property} urls)
Any better way? I like spring fox for not providing more than one tag, also the auto generated tag names are better e.g. Books Entity instead of books-entity-controller. But it would be better either to customize it or find a better alternative.
I recommand Spring REST Docs over Swagger. Spring REST Docs is test-driven to guarantee your API documentation is always sync with your API.
Andy's talk explains more why Spring REST Docs is more suitable than Swagger for API documentation.
You can find offical simple guide and more samples.
My Github project uses it. You can clone the repository and have a look at the generated documentation HTML /sga-booking/index.html.
Related Spring REST Docs file are
FltApiDocumentation.java
flts.adoc
BookingApiDocumentation.java
booking.adoc
If you find my Github useful, consider give it a star.
Springdoc
I can not change neither the tag name nor the description (#Tag does not work on repos)
and
The same repo gets 3 tags
You can customize it. Use the following at the controller-class level.
#Tag(name = "Name of the Tag", description = "Description of the tag")
or
#Tags(value = {
// Multiple #Tag annotations separated by comma ,
})
or the following at the method level.
#Operation(tags = {"Tag 1", "Tag 2"})
Remember:
#Tag at a class level will override the operation level tags for the particular class.
A class level tag can have only 1 value.
So if you need a controller to have multiple tags, you should isolate it in a different class that doesn't have the #Tag at the class level.
No support for projections
I have never used projections. I generally use the #JsonIgnore to eliminate the ones not needed, but depends on your use-case.
If you want to hide something from a schema, use can use the below method
#Schema(description = "Example POJO to demonstrate the hidden attribute")
class Example {
...
#Schema(hidden = true) // <--- Will be hidden from the Swagger UI completely
String exampleId;
...
}
Hope that helps. Drop a comment for any clarification.
I was looking at the GS1 Tag Data Standard and noticed the EPC has a CRC-16. However, the unique tag ID (TID), specified in Section 16, does not.
Is that the case there is no checksum on the Tag ID? If so, what is the suggested method to ensure the tag ID that is read is in fact the actual value and that no bits were flipped?
Got my answer from another message board. I'll post a summary here.
I was focused on the "StoredCRC" defined in the Memory spec mentioned above. However, I was pointed to the Air Interface spec. In there, it defines both the StoredCRC as well as the PacketCRC. The latter is used for many interrogator->tag and tag->interrogator messages.
Some notable references in that spec:
Section 6.3.1.5 gave a nice overview
Section 6.3.2.1.2.1 described how StoredCRC and PacketCRC are managed/used
Table 6.17 and Table 6.28 were good examples of the structure
Is it possible to access all the fields from a previous step as a collection like json rather than having to explicitly setting each one in the input data?
Hope the screenshot illustrates the idea:
https://www.screencast.com/t/TTSmUqz2auq
The idea is I have a step that lookup responses in a google form and I wish to parse the result to display all the Questions and Answer into an email.
Hope this is possible
Thanks
David here, from the Zapier Platform team. Unfortunately, what I believe you're describing right now isn't possible. Usually this works fine since users only map a few values. The worst case is when you want every value, which it sounds like you're facing. It would be cool to map all of them. I can pass that along to the team! In the meantime, you'll have to click everything you're going use in the code step.
If you really don't want to create a bunch of variables, but you could map them all into a single input and separate them with a separator like |, which (as long as it doesn't show up in the data), it's easy to split in the code step.
Hope that helps!
The simplest solution would be to create an additional field in the output object that is a JSON string of the output. In a Python code step, it would look like
import json
output = {'id': 123, 'hello': 'world'}
output['allfields'] = json.dumps(output)
or for returning a list
import json
output = [{'id': 123, 'hello': 'world'},{'id': 456, 'bye': 'world'}]
for x in output:
x['allfields'] = json.dumps(output[output.index(x)])
Now you have the individual value to use in steps as well as ALL the values to use in a code step (simply convert them from JSON). The same strategy holds for Javascript as well (I simply work in Python).
Zapier Result
Fields are accessible in an object called input_data by default. So a very simplistic way of grabbing a value (in Python) would be like:
my_variable = input_data['actual_field_name_from_previous_step']
This differs from explicitly naming the the field with Input Data (optional). Which as you know, is accessed like so:
my_variable = input['your_label_for_field_from_previous_step']
Here's the process description in Zapier docs.
Hope this helps.
I've been asked to prototype a replacement "file transformation process" (that currently is a mess of SQL) using Altova's MapForce. My input is a CSV file with headers. My problem is that I need to capture both the data AND the column name to use in downstream processing.
I need to have MapForce feed a C# method (imported as that takes two parameters: fieldName and value. I can access the value trivially, but after hours pouring over the manual (1000 pages!) I haven't found any examples of how to access the field name as an output.
The reason each output needs the field name and the value has to do with how all our mappings/transformations are currently managed - on a database. The .NET code jumps in at this point and does any necessary database lookups.
For example, if I had the following file:
"Symbol", "Account", "Price", ...
"FOO", "10101", "1.23", ...
"BAR", "10201, "13.56", ...
And a static method string TransformField( string fieldName, string value ),
I'd like to map the CSV file's Symbol data output to the method's value parameter and the Field Name "Symbol" to the method's fieldName parameter.
Some limitations:
I need to keep the "wiring" visible in the MapForce GUI. I'll have non-programmers maintaining the mappings in the future. So doing all this in code is not an option.
MapForce is the tool of choice by the company. Part of the reason our original process is such a mess is because the original programmer rolled his own mapping/transformation tool (out of TSQL no less - ouch).
We can treat all inputs/outputs to the method call as strings. Conversions will happen later.
I would like to avoid using scalar literals as inputs. I already have the column names from the file - I do not want to re-type each one and feed it to my method.
I'm not sure how many users out there have experience with this tool, but after 3 days of tinkering with it, I see much potential. If only I can get past this current sticking point, I think the company will have a solid alternative to their current mess.
Thanks for any/all suggestions.
I solved my issue and, for future reference, want to post a solution. I handled my problem by using MapForce's FlexText. This allowed me to extract the header from the CSV file and "invert" the column names as data inputs to the transformation process. Once I knew the approach to take, I was able to find more information directly from Altova.
I found a couple helpful tutorials while digging through their website:
Altova Online Videos
Web Tutorial
Hope this can help someone else in the future!