https://goo.gl/qNMYGa - ex1
https://goo.gl/FyZO3J - todos
https://goo.gl/gRLk3U - root/child
https://goo.gl/KdYigG - toArray
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import io.swagger.annotations.ApiModelProperty; | |
import javax.validation.constraints.NotNull; | |
@RestController | |
@RequestMapping("/users") | |
class UserResource { | |
@GetMapping() | |
List<User> allUsers() { /* ... */ } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useEffect, useState } from 'react'; | |
import { Configuration, User, UserResourceApi, UserRolesEnum } from "./api/src"; | |
const config = new Configuration({ | |
basePath: window.location.origin, // 1 | |
}); | |
const userApi = new UserResourceApi(config); // 2 | |
const isAdmin = (user: User) => user.roles.includes(UserRolesEnum.ADMIN) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
rm -rf src/api | |
npx @openapitools/openapi-generator-cli generate \ | |
-i http://localhost:8080/v2/api-docs \ | |
-g typescript-fetch \ | |
-o src/api |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"scripts": { | |
"api": "openapi-generator generate -i http://localhost:8080/v2/api-docs -g typescript-fetch --skip-validate-spec -o src/api/" | |
}, | |
"devDependencies": { | |
"@openapitools/openapi-generator-cli": "^1.0.12-4.3.0" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependency> | |
<groupId>io.springfox</groupId> | |
<artifactId>springfox-swagger2</artifactId> | |
<version>2.9.2</version> | |
</dependency> | |
<dependency> | |
<groupId>io.springfox</groupId> | |
<artifactId>springfox-bean-validators</artifactId> | |
<version>2.9.2</version> | |
</dependency> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Configuration @EnableSwagger2 | |
@Import(BeanValidatorPluginsConfiguration.class) | |
public class SwaggerConfig { | |
@Bean | |
public Docket api() { | |
return new Docket(DocumentationType.SWAGGER_2).select() | |
.apis(RequestHandlerSelectors.basePackage(getClass().getPackageName())) | |
.paths(PathSelectors.any()).build(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# awk -f call-hierarchy-to-graph.awk call-stack.txt |dot -Tpng -o call-stack.png | |
BEGIN { | |
print "digraph {" | |
path[-1]="start" | |
} | |
{ | |
depth=(match($0, /[^ ]/)-1)/4; | |
gsub(/^ +/,"") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eu | |
cd `dirname $0` | |
docker build . -t gcr.io/sandbox-p/spring | |
docker push gcr.io/sandbox-p/spring | |
gcloud run deploy spring \ | |
--image=gcr.io/sandbox-p/spring \ | |
--platform managed \ | |
--region europe-west1 \ | |
--allow-unauthenticated |