Skip to content

Commit

Permalink
Merge pull request #1289 from hdurix/rest-naming-convention
Browse files Browse the repository at this point in the history
Naming convention for APIs
  • Loading branch information
hdurix authored Apr 8, 2022
2 parents 4699e6a + 0ab3664 commit f201f98
Show file tree
Hide file tree
Showing 75 changed files with 239 additions and 217 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import tech.jhipster.lite.technical.infrastructure.primary.annotation.GeneratorStep;

@RestController
@RequestMapping("/api/github-actions/")
@RequestMapping("/api/developer-tools/github-actions/")
@Tag(name = "Continuous Integration")
class GitHubActionsResource {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void addAngular(@RequestBody ProjectDTO projectDTO) {

@Operation(summary = "Add Angular with minimal CSS")
@ApiResponse(responseCode = "500", description = "An error occurred while adding Angular with minimal CSS")
@PostMapping("/styled")
@PostMapping("/styles")
@GeneratorStep(id = GeneratorAction.ANGULAR_STYLED)
public void addStyledAngular(@RequestBody ProjectDTO projectDTO) {
Project project = ProjectDTO.toProject(projectDTO);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void addReact(@RequestBody ProjectDTO projectDTO) {

@Operation(summary = "Add React+Vite with minimal CSS", description = "Add React+Vite with minimal CSS")
@ApiResponse(responseCode = "500", description = "An error occurred while adding React+Vite with minimal CSS")
@PostMapping("/styled")
@PostMapping("/styles")
@GeneratorStep(id = GeneratorAction.REACT_STYLED)
public void addStyledReact(@RequestBody ProjectDTO projectDTO) {
Project project = ProjectDTO.toProject(projectDTO);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void addSvelte(@RequestBody ProjectDTO projectDTO) {

@Operation(summary = "Add SvelteKit with minimal CSS")
@ApiResponse(responseCode = "500", description = "An error occurred while adding SvelteKit with minimal CSS")
@PostMapping("/styled")
@PostMapping("/styles")
@GeneratorStep(id = GeneratorAction.SVEKTEKIT_STYLE)
public void addStyledSvelteKit(@RequestBody ProjectDTO projectDTO) {
Project project = ProjectDTO.toProject(projectDTO);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void addVue(@RequestBody ProjectDTO projectDTO) {

@Operation(summary = "Add Vue+Vite with minimal CSS", description = "Add Vue+Vite with Minimal CSS")
@ApiResponse(responseCode = "500", description = "An error occurred while adding Vue+Vite with minimal CSS")
@PostMapping("/styled")
@PostMapping("/styles")
@GeneratorStep(id = GeneratorAction.VUE_STYLED)
public void addStyledVue(@RequestBody ProjectDTO projectDTO) {
Project project = ProjectDTO.toProject(projectDTO);
Expand All @@ -44,7 +44,7 @@ public void addStyledVue(@RequestBody ProjectDTO projectDTO) {

@Operation(summary = "Add Pinia", description = "Add pinia for state management")
@ApiResponse(responseCode = "500", description = "An error occurred while adding Pinia")
@PostMapping("/pinia")
@PostMapping("/stores/pinia")
@GeneratorStep(id = GeneratorAction.VUE_PINIA)
public void addPinia(@RequestBody ProjectDTO projectDTO) {
Project project = ProjectDTO.toProject(projectDTO);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import tech.jhipster.lite.generator.project.domain.Project;

@RestController
@RequestMapping("/api/projects")
@RequestMapping("/api/project-histories")
@Tag(name = "History")
class HistoryResource {

Expand All @@ -26,7 +26,7 @@ public HistoryResource(GeneratorHistoryApplicationService generatorHistoryApplic

@Operation(summary = "Get project history")
@ApiResponse(responseCode = "500", description = "An error occurred while getting history project")
@GetMapping("/history")
@GetMapping
public ResponseEntity<HistoryDTO> get(
@Parameter(description = "Project path to get history") @RequestParam(value = "folder") String folder
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import tech.jhipster.lite.technical.infrastructure.primary.annotation.GeneratorStep;

@RestController
@RequestMapping("/api/projects")
@RequestMapping("/api")
@Tag(name = "Init")
class InitResource {

Expand All @@ -31,7 +31,7 @@ public InitResource(InitApplicationService initApplicationService) {

@Operation(summary = "Init project")
@ApiResponse(responseCode = "500", description = "An error occurred while initializing project")
@PostMapping("/init")
@PostMapping("/projects")
@GeneratorStep(id = GeneratorAction.INIT)
public void init(@RequestBody ProjectDTO projectDTO) {
Project project = ProjectDTO.toProject(projectDTO);
Expand All @@ -40,7 +40,7 @@ public void init(@RequestBody ProjectDTO projectDTO) {

@Operation(summary = "Download project")
@ApiResponse(responseCode = "500", description = "An error occurred while downloading project")
@PostMapping("/download")
@PostMapping("/project-downloads")
@GeneratorStep(id = GeneratorAction.DOWNLOAD)
public ResponseEntity<Resource> download(@RequestBody ProjectDTO projectDTO) {
Project project = ProjectDTO.toProject(projectDTO);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import tech.jhipster.lite.technical.infrastructure.primary.annotation.GeneratorStep;

@RestController
@RequestMapping("/api/npm")
@RequestMapping("/api/package-managers/npm")
@Tag(name = "NPM")
class NpmResource {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void npmInstall(Project project) {
try {
this.runProcess(project, Npm.getExecutableCommand(), "install");
} catch (IOException e) {
throw new GeneratorException("Error when running \"npm install\"");
throw new GeneratorException("Error when running \"npm install\"", e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import tech.jhipster.lite.technical.infrastructure.primary.annotation.GeneratorStep;

@RestController
@RequestMapping("/api/frontend-maven-plugin")
@RequestMapping("/api/developer-tools/frontend-maven-plugin")
@Tag(name = "Frontend Maven Plugin")
class FrontendMavenResource {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import tech.jhipster.lite.technical.infrastructure.primary.annotation.GeneratorStep;

@RestController
@RequestMapping("/api/servers/sonar")
@RequestMapping("/api/developer-tools/sonar")
@Tag(name = "Sonar")
class SonarResource {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import tech.jhipster.lite.technical.infrastructure.primary.annotation.GeneratorStep;

@RestController
@RequestMapping("/api/servers/spring-boot/banner")
@RequestMapping("/api/servers/spring-boot/banners")
@Tag(name = "Spring Boot")
class BannerResource {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import tech.jhipster.lite.technical.infrastructure.primary.annotation.GeneratorStep;

@RestController
@RequestMapping("/api/servers/spring-boot/cache/ehcache")
@RequestMapping("/api/servers/spring-boot/caches/ehcache")
@Tag(name = "Spring Boot - Cache")
class EhcacheResource {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import tech.jhipster.lite.technical.infrastructure.primary.annotation.GeneratorStep;

@RestController
@RequestMapping("/api/servers/spring-boot/cache/simple")
@RequestMapping("/api/servers/spring-boot/caches/simple")
@Tag(name = "Spring Boot - Cache")
class SpringBootCacheSimpleResource {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import tech.jhipster.lite.technical.infrastructure.primary.annotation.GeneratorStep;

@RestController
@RequestMapping("/api/servers/spring-boot/databases/migration/flyway")
@RequestMapping("/api/servers/spring-boot/database-migration-tools/flyway")
@Tag(name = "Spring Boot - Database Migration")
class FlywayResource {

Expand All @@ -26,7 +26,7 @@ public FlywayResource(FlywayApplicationService flywayApplicationService) {

@Operation(summary = "Add Flyway")
@ApiResponse(responseCode = "500", description = "An error occurred while adding Flyway")
@PostMapping("/init")
@PostMapping
@GeneratorStep(id = GeneratorAction.FLYWAY)
public void init(@RequestBody ProjectDTO projectDTO) {
Project project = ProjectDTO.toProject(projectDTO);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import tech.jhipster.lite.technical.infrastructure.primary.annotation.GeneratorStep;

@RestController
@RequestMapping("/api/servers/spring-boot/databases/migration/liquibase")
@RequestMapping("/api/servers/spring-boot/database-migration-tools/liquibase")
@Tag(name = "Spring Boot - Database Migration")
class LiquibaseResource {

Expand All @@ -26,7 +26,7 @@ public LiquibaseResource(LiquibaseApplicationService liquibaseApplicationService

@Operation(summary = "Add Liquibase")
@ApiResponse(responseCode = "500", description = "An error occurred while adding Liquibase")
@PostMapping("init")
@PostMapping
@GeneratorStep(id = GeneratorAction.LIQUIBASE)
public void init(@RequestBody ProjectDTO projectDTO) {
Project project = ProjectDTO.toProject(projectDTO);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import tech.jhipster.lite.technical.infrastructure.primary.annotation.GeneratorStep;

@RestController
@RequestMapping("/api/servers/spring-boot/devtools")
@RequestMapping("/api/servers/spring-boot/technical-tools/devtools")
@Tag(name = "Spring Boot - Tools")
class DevToolsResource {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import tech.jhipster.lite.technical.infrastructure.primary.annotation.GeneratorStep;

@RestController
@RequestMapping("/api/servers/spring-boot/docker")
@RequestMapping("/api/servers/spring-boot/containers/docker")
@Tag(name = "Spring Boot - Tools")
class SpringBootDockerResource {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import tech.jhipster.lite.technical.infrastructure.primary.annotation.GeneratorStep;

@RestController
@RequestMapping("/api/servers/spring-boot/logging/aop")
@RequestMapping("/api/servers/spring-boot/log-tools/aop")
@Tag(name = "Spring Boot - Logging")
class AopLoggingResource {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import tech.jhipster.lite.technical.infrastructure.primary.annotation.GeneratorStep;

@RestController
@RequestMapping("/api/servers/spring-boot/logging/logstash")
@RequestMapping("/api/servers/spring-boot/log-tools/logstash")
@Tag(name = "Spring Boot - Logging")
class LogstashResource {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import tech.jhipster.lite.technical.infrastructure.primary.annotation.GeneratorStep;

@RestController
@RequestMapping("/api/servers/spring-boot/mvc/dummy")
@RequestMapping("/api/servers/spring-boot/features/dummy")
@Tag(name = "Spring Boot - MVC")
class DummyResource {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import tech.jhipster.lite.technical.infrastructure.primary.annotation.GeneratorStep;

@RestController
@RequestMapping("/api/servers/spring-boot/mvc/security")
@RequestMapping("/api/servers/spring-boot/security-systems")
@Tag(name = "Spring Boot - MVC - Security")
class JwtSecurityResource {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import tech.jhipster.lite.technical.infrastructure.primary.annotation.GeneratorStep;

@RestController
@RequestMapping("/api/servers/spring-boot/mvc/security")
@RequestMapping("/api/servers/spring-boot/security-systems")
@Tag(name = "Spring Boot - MVC - Security")
class OAuth2SecurityResource {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import tech.jhipster.lite.technical.infrastructure.primary.annotation.GeneratorStep;

@RestController
@RequestMapping("/api/servers/spring-boot/mvc/springdoc")
@RequestMapping("/api/servers/spring-boot/api-documentations/springdoc")
class SpringdocResource {

private final SpringdocApplicationService springdocApplicationService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import tech.jhipster.lite.technical.infrastructure.primary.annotation.GeneratorStep;

@RestController
@RequestMapping("/api/servers/spring-boot/mvc/web")
@RequestMapping("/api/servers/spring-boot")
@Tag(name = "Spring Boot - MVC")
class SpringBootMvcResource {

Expand All @@ -26,7 +26,7 @@ public SpringBootMvcResource(SpringBootMvcApplicationService springBootMvcApplic

@Operation(summary = "Add Spring Boot MVC with Tomcat")
@ApiResponse(responseCode = "500", description = "An error occurred while adding Spring Boot MVC with Tomcat")
@PostMapping("/tomcat")
@PostMapping("/web-servers/tomcat")
@GeneratorStep(id = GeneratorAction.SPRINGBOOT_TOMCAT)
public void addSpringBootMvc(@RequestBody ProjectDTO projectDTO) {
Project project = ProjectDTO.toProject(projectDTO);
Expand All @@ -35,7 +35,7 @@ public void addSpringBootMvc(@RequestBody ProjectDTO projectDTO) {

@Operation(summary = "Add Spring Boot MVC with Undertow")
@ApiResponse(responseCode = "500", description = "An error occurred while adding Spring Boot MVC with Undertow")
@PostMapping("/undertow")
@PostMapping("/web-servers/undertow")
@GeneratorStep(id = GeneratorAction.SPRINGBOOT_UNDERTOW)
public void addSpringBootUndertow(@RequestBody ProjectDTO projectDTO) {
Project project = ProjectDTO.toProject(projectDTO);
Expand All @@ -44,7 +44,7 @@ public void addSpringBootUndertow(@RequestBody ProjectDTO projectDTO) {

@Operation(summary = "Add Spring Boot Actuator")
@ApiResponse(responseCode = "500", description = "An error occurred while adding Spring Boot Actuator")
@PostMapping("/actuator")
@PostMapping("/technical-tools/actuator")
@GeneratorStep(id = GeneratorAction.SPRINGBOOT_ACTUATOR)
public void addSpringBootActuator(@RequestBody ProjectDTO projectDTO) {
Project project = ProjectDTO.toProject(projectDTO);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import tech.jhipster.lite.technical.infrastructure.primary.annotation.GeneratorStep;

@RestController
@RequestMapping("/api/servers/spring-boot/spring-cloud/config-client")
@RequestMapping("/api/servers/spring-boot/distributed-systems/spring-cloud/config-client")
@Tag(name = "Spring Boot - Spring Cloud")
class SpringCloudConfigResource {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import tech.jhipster.lite.technical.infrastructure.primary.annotation.GeneratorStep;

@RestController
@RequestMapping("/api/servers/spring-boot/spring-cloud/consul")
@RequestMapping("/api/servers/spring-boot/distributed-systems/spring-cloud/consul")
@Tag(name = "Spring Boot - Spring Cloud")
class ConsulResource {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import tech.jhipster.lite.technical.infrastructure.primary.annotation.GeneratorStep;

@RestController
@RequestMapping("/api/servers/spring-boot/spring-cloud/eureka-client")
@RequestMapping("/api/servers/spring-boot/distributed-systems/spring-cloud/eureka-client")
@Tag(name = "Spring Boot - Spring Cloud")
class EurekaResource {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import tech.jhipster.lite.technical.infrastructure.primary.annotation.GeneratorStep;

@RestController
@RequestMapping("/api/servers/spring-boot/user")
@RequestMapping("/api/servers/spring-boot/features/user")
@Tag(name = "Spring Boot - User")
class SpringBootUserResource {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
import tech.jhipster.lite.technical.infrastructure.primary.annotation.GeneratorStep;

@RestController
@RequestMapping("/api/setup")
@Tag(name = "Setup")
@RequestMapping("/api/developer-tools/codespaces")
@Tag(name = "Codespaces")
class CodespacesResource {

private final CodespacesApplicationService codespacesApplicationService;
Expand All @@ -26,7 +26,7 @@ public CodespacesResource(CodespacesApplicationService codespacesApplicationServ

@Operation(summary = "GitHub Codespaces", description = "Init GitHub Codespaces configuration files")
@ApiResponse(responseCode = "500", description = "An error occurred while initializing GitHub Codespaces files.")
@PostMapping("/codespaces")
@PostMapping
@GeneratorStep(id = GeneratorAction.GITHUB_CODESPACES)
public void init(@RequestBody ProjectDTO projectDTO) {
Project project = ProjectDTO.toProject(projectDTO);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import tech.jhipster.lite.technical.infrastructure.primary.annotation.GeneratorStep;

@RestController
@RequestMapping("/api/typescript")
@RequestMapping("/api/javascript-languages/typescript")
@Tag(name = "Typescript")
class TypescriptResource {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ export default class ProjectHistoryRepository implements ProjectHistoryService {
constructor(private axiosHttp: AxiosHttp) {}

async get(folder: Folder): Promise<History> {
return this.axiosHttp.get<RestHistory>('api/projects/history', { params: { folder } }).then(response => toHistory(response.data));
return this.axiosHttp.get<RestHistory>('api/project-histories', { params: { folder } }).then(response => toHistory(response.data));
}
}
4 changes: 2 additions & 2 deletions src/main/webapp/app/springboot/secondary/ProjectRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default class ProjectRepository implements ProjectService {

async init(project: Project): Promise<void> {
const restProject: RestProject = toRestProject(project);
await this.axiosHttp.post('api/projects/init', restProject);
await this.axiosHttp.post('api/projects', restProject);
}

async addMaven(project: Project): Promise<void> {
Expand All @@ -18,7 +18,7 @@ export default class ProjectRepository implements ProjectService {

async addFrontendMavenPlugin(project: Project): Promise<void> {
const restProject: RestProject = toRestProject(project);
await this.axiosHttp.post('api/frontend-maven-plugin', restProject);
await this.axiosHttp.post('api/developer-tools/frontend-maven-plugin', restProject);
}

async addJavaBase(project: Project): Promise<void> {
Expand Down
Loading

0 comments on commit f201f98

Please sign in to comment.