question about AVRO specification and creating a simple REST endpoint - ruby-on-rails

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.

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.

GraphQL: Stop Neo4jGraphQL translate my models during generation

I'm an experienced developer, but rather new to GraphQL.
I use this Neo4j-Tutorial as a basis for orientation and am developing in typescript (backend and frontend).
Can anyone tell me how to somehow rename the generated Endpoints from #neo4j/graphql? The corresponding docs don't help with that.
I use the following GraphQL-Schema for demonstration (it's german: "Person" means "person" and "Tier" means "animal"):
type Person {
name: String
}
type Tier {
name: String
}
I process the schema using the gql-Function (from apollo-server) first, the result of that does look OK.
Afterwards, when I call const neoSchema = new Neo4jGraphQL({ typeDefs, driver: drv }) (with drv being my Neo4j-Driver) the resulting neoSchema.schema shows up some unexpected naming in the generated endpoints, e.g.:
CreatePeopleMutationResponse: CreatePeopleMutationResponse,
UpdatePeopleMutationResponse: UpdatePeopleMutationResponse,
Somehow the german "Person" (plural being "Personen") got implicitly translated to "people". I can also think of some "false friends" where this effect is even worse.
Well, the API should be in my own language (following DDD), so that's a smell I want to rename also having the api-users and generated clients in mind. How is that possible?
Thank you!

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.

Swagger jaxrs Doclet custom annotations not generating output

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?

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