gen-controller

Generate Java/Spring Boot controller and RestDocs test classes from UseCase interfaces.

Updated Jul 27, 2024
One-click install
npx skills add https://github.com/Jeongjjuna/ontongsal --skill gen-controller
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gen-controller
Source: https://github.com/Jeongjjuna/ontongsal/tree/main/spring-rest-api/.claude/skills/gen-controller
Command: npx skills add https://github.com/Jeongjjuna/ontongsal --skill gen-controller

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires kotlin, spring boot, rest docs, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill automatically generates Controller and Spring REST Docs-based ControllerTest files from an input UseCase interface, reducing the time and effort spent on manual code creation.

Core Features & Use Cases

  • Controller Generation: Generates Controller classes with the appropriate HTTP endpoints, mappings, and validation based on UseCase interface inputs.
  • Test Generation: Generates Spring MVC Test cases using Rest Docs for verifying controller functionality.
  • Use Case: Quickly implement REST APIs with tests in minutes instead of hours by inputting a UseCase interface file.

Quick Start

To generate a Controller and tests for a UseCase interface, provide the path to the UseCase file using the 'gen-controller' skill.

Frequently Asked Questions about gen-controller

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automatically generate Spring Boot controllers from a UseCase interface?

You can automatically generate Spring Boot controllers by providing a UseCase interface file path to the generator, which parses the input methods and creates Java controller classes with appropriate HTTP endpoint mappings.

Can I generate Spring REST Docs test classes for my controllers automatically?

Yes, Spring REST Docs test classes are generated automatically alongside the controller classes. The generator creates Spring MVC Test cases using REST Docs to verify the controller functionality derived from the UseCase interface.

Do I need Kotlin to generate Java controllers and tests for my UseCase interfaces?

Yes, Kotlin is required to run the controller and test generator. Along with Kotlin, the Spring Boot framework and REST Docs libraries must be present in your environment for the generated Java code to operate correctly.

What is the best way to reduce manual boilerplate when implementing REST APIs in Spring Boot?

The best way to reduce manual boilerplate is generating controllers and REST Docs test classes directly from UseCase interface definitions. This automates HTTP mapping creation and test setup, implementing REST APIs in minutes instead of hours.

Does the generated controller include validation based on the UseCase interface inputs?

Yes, the generated Spring Boot controller classes include appropriate validation based on the inputs defined in the UseCase interface. The parser reads these interface methods to determine the necessary HTTP endpoint mappings and validation rules.