Swagger jaxrs Doclet custom annotations not generating output - swagger

I'm using the very helpful swagger-jaxrs-doclet tool from teamcarma to generate the json files necessary to feed into a swagger-ui front end for documenting my RESTful services.
An issue that I'm having is that the custom annotations (e.g. #bodyType ) described in the doclet documentation do not appear to be picked up by the doclet at time of documentation generation.
Taking an example from the doclet documentation itself, I may have a service endpoint documented as such:
/**
* #inputType fixtures.inputtype.Data2
*/
#POST
#Path("/postData2b")
public Response postData2b(#HeaderParam("X-forwarded-for") String xFwd, #QueryParam("p1") int p1, Data1 data) {
return Response.ok().build();
}
I would expect the #inputType annotation to be used for supplying the body model.
Unfortunately, the annotation is completely ignored.
Has anyone had a similar problem working with swagger-jaxrs-doclet? How did you over come it?

Related

Typo3 v10 Persistence Mapping foreignClass

since Typo3 v10 you have to use Classes.php file in Configuration/extbase/Persistence Folder for configuration of persistence table mapping.
Does anyone know how to implement
config.tx_extbase.persistence.classes {
Domain\DomainUsergroupMailer\Domain\Model\FrontendUserGroups {
mapping {
tableName = fe_groups
columns {
subgroup.foreignClass = TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup
}
}
}
I can't find documentation concerning the foreignClass Parameter.
I found parameter subclasses in https://docs.typo3.org/m/typo3/book-extbasefluid/10.4/en-us/6-Persistence/5-modeling-the-class-hierarchy.html
Does anyone know if this is the right way parameter and how to use it?
Thank you
There never was such a feature in TYPO3 as confirmed by searching the TYPO3v9 source code for foreignClass. So this must be provided by a 3rd party extension.
However, from the name it sounds like you only need to use an appropriate element type for your collection relation:
/**
* #var ObjectStorage<FrontendUserGroup>
*/
private ObjectStorage $subgroup;
See Implementing the domain model for details.

question about AVRO specification and creating a simple REST endpoint

I have a Rails endpoint like this:
professionals/123/featured_articles
where we do a POST and GET. I'm looking into creating an AVRO .avdl file but am not sure how it should be created. I have:
#namespace("API")
protocol Professional {
record Professional{
/** The primary key */
int id;
}
}
Is there a way to specify a custom endpoint like in Rails where it is:
/professionals/:professional_id/featured_articles
It seems like all of our AVRO endpoints are specified at a single depth and not sure why? Maybe I'm missing something about the overall goal of AVRO. I have worked with Protocol Buffers before so familiar with most of the concepts but not sure about our endpoint generation.

Is there an ANY "escape" in Swagger

I have a REST API where legal JSON submitted to an endpoint will contain a sub tree depending on a "type" declaration in the top level. Something like:
{
...
"mtype": "http:...",
"content": {
.. what goes here is what would be defined by the above "mtype"
Essentially, the 'mtype' is the schema url for what goes into 'content'. But what I'm looking for is the equivalent of <xsd:any>.
It would already be useful if I can put something in there which would instruct the Swagger UI to simply put a large text box there for users to paste a JSON body.
you can return an object of type object with no properties as a response. It's not best practice but it can serve your purposes
I don't know Swagger that well, but I know it's type definition is based on JSON Schema. In JSON Schema, the equivalent of <xsd:any> is {}. The empty schema validates as true for any valid JSON. I expect this should be no different in Swagger.

How to manually get/set object model from AngularDart component?

Angular manages our objects somewhere in the Scope, but I need to manually set and get the object that controls a component so I can automatically set all the component's info once I download its model from the web through JSON.
Example
#Component (selector: 'my-component')
class MyComponent {
//component fields
}
As the user interacts with <my-component> it changes its fields. I want to be able to get the whole MyComponent object with its fields to save them like this
MyComponent comp = magicComponentGetterFunc('my-component');
String json = encodeJson (comp); //I do this this redstone_mapper
I think ngProbe can do that.
ElementProbe ep = ngProbe('my-component');
You can can find examples by visiting the links at https://pub.dartlang.org/packages/angular where ngProbe or ElementProbe is mentioned.
The CHANGELOG.md mentions that ngProbe is necessary for animation but the codedoc on the ElementProbe class still states that it is for testing and debugging (see https://github.com/angular/angular.dart/blob/96c0bcc7b6b0c3501b2c4799f425de8cd2e4dc0c/lib/core_dom/view_factory.dart#L259)
To get the JSON you either have to implement a getter/method (for example toJson) that returns the JSON you want or use some of the available serialization solutions (see State of Serialization and Deserialization of JSON in Dart).
If you want to do that this usually indicates that your approach works against the way Angular should be used.

Jira issues in JSON format (Need to know thw classes and functions called by I am trying to use the REST API "api/2.0.alpha1/issue/{issueKey}"

I am trying to use the REST API api/2.0.alpha1/issue/{issueKey} .
Reference: http://docs.atlassian.com/jira/REST/4.4.3/#id2413591
I would get all issue id's from rest/api/2.0.alpha1/search
Using these issue IDs get all issues in JSON format.
But as I am using localhost (local Machine) I do not want to make network calls and increase network traffic. Hence I wanted to know which class in JAVA does these URIs call so that I can directly call these classes to get the issues in JSON format.
Basically I want all the issues in JSON format without network calls.
OR
I also have all the issue retrieved in issues object but not in JSON format. How can I convert that into JSON format?
I have found the following code from JIRA:
#GET
#Path ("/{issueKey}")
public Response getIssue(#PathParam ("issueKey") final String issueKey)
{
final Issue issue = getIssueObject(issueKey);
final IssueBean bean = createIssue(issue);
return Response.ok(bean).cacheControl(never()).build();
}
You could search the source code for the #GET references or use the REST API browser (https://developer.atlassian.com/display/RAB/Overview+of+the+Atlassian+REST+API+Browser)
but accessing the classes from Java probably means that you need to be running in the same class loader as JIRA or using a plugin.
Have you measured the overhead of the calls to make sure that you are not optimizing prematurely?

Resources