Skip to content

Commit

Permalink
Refactored code generation (#53)
Browse files Browse the repository at this point in the history
* Implemented graph generator

* Added property definition

* Added definitions

* Added name generator

* Name generator finished

* Added interfaces

* Added extends to dto

* Added service interface

* Started class generation

* Dto generation

* Added attribute generator

* * Interface generator
* Fixes
* Temp old style

* * DateTime disabled default value
* Good exception text on schema parsing

* Totally equal generated code

* Set all helpers to public

* Typo fix

* Typo

* Added graph definition

* Implemented service subscriber

* Implemented command

* Removed old code

* Moved Definitions

* Unified generated files

* Re-arranged generated files

* Reworked names and files

* Changed events

* Initial codestyle fix

* Stan

* Fixes

* Finished tests

Co-authored-by: Dimannn <[email protected]>
  • Loading branch information
DimanKuskov and Dimannn authored Apr 20, 2020
1 parent 363320a commit 6afa90b
Show file tree
Hide file tree
Showing 79 changed files with 2,322 additions and 3,310 deletions.
81 changes: 18 additions & 63 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,66 +197,21 @@ by changing the objects representing the various code definitions like classes,

The following events are available:

- `OnMoon\OpenApiServerBundle\Event\CodeGenerator\RequestDtoGenerationEvent`

The RequestDtoGenerationEvent event occurs before the request dto is generated.
This event allows you to modify the definitions of the generated request DTO customizing the generated code.
- `OnMoon\OpenApiServerBundle\Event\CodeGenerator\RequestParameterDtoGenerationEvent`

The RequestParameterDtoGenerationEvent event occurs before the path and query parameters DTO's are generated for the
Request Dto.
This event allows you to modify the definitions of the generated Parameters DTO's customizing the generated code.
The parametersType() method returns either "path" or "query" and indicates what part of the RequestDTO is the
ParameterDTO generated for.
- `OnMoon\OpenApiServerBundle\Event\CodeGenerator\PropertyDtoGenerationEvent`

The PropertyDtoGenerationEvent event occurs before any of the DTOs nested in the Request Body or Response are generated.
This event allows you to modify the definitions of the generated nested DTOs that are used in the Request Body
and Response DTOs, customizing the generated code.
- `OnMoon\OpenApiServerBundle\Event\CodeGenerator\RequestBodyDtoGenerationEvent`

The RequestBodyDtoGenerationEvent event occurs before the request body dto is generated.
This event allows you to modify the definitions of the generated request body DTO customizing the generated code.
- `OnMoon\OpenApiServerBundle\Event\CodeGenerator\ResponseDtoGenerationEvent`

The ResponseDtoGenerationEvent event occurs before the response dto is generated.
This event allows you to modify the definitions of the generated response DTOs customizing the generated code.
- `OnMoon\OpenApiServerBundle\Event\CodeGenerator\ResponseDtoMarkerInterfaceGenerationEvent`

The ResponseDtoMarkerInterfaceGenerationEvent event occurs before the response DTO marker interface is generated.
This marker interface is used for typehinting if a Request Handler returns multiple possible Response DTO's.
This event allows you to modify the definition of the generated response DTO marker interface customizing the
generated code.
- `OnMoon\OpenApiServerBundle\Event\CodeGenerator\RequestHandlerInterfaceGenerationEvent`

The RequestHandlerInterfaceGenerationEvent event occurs before the request handler interface is generated.
This event allows you to modify the definitions of the generated request handler interfaces customizing the
generated code.
- `OnMoon\OpenApiServerBundle\Event\CodeGenerator\ServiceSubscriberGenerationEvent`

The ServiceSubscriberGenerationEvent event occurs before the service subscriber is generated.
This event allows you to modify the definition of the generated service subscriber customizing the generated code.
- `OnMoon\OpenApiServerBundle\Event\CodeGenerator\ClassPropertyGenerationEvent`

The ClassPropertyGenerationEvent event occurs before a class property is generated in
RequestBody/RequestParameters/Resposne DTO's.
This event allows you to modify the definitions of the generated class properties in
RequestBody/RequestParameters/Resposne DTO's customizing the generated code.
- `OnMoon\OpenApiServerBundle\Event\CodeGenerator\ConstructorParameterGenerationEvent`

The ConstructorParameterGenerationEvent event occurs before a constructors parameter is generated in
RequestBody/RequestParameters/Resposne DTO's.
This event allows you to modify the definitions of the generated constructors parameters in
RequestBody/RequestParameters/Resposne DTO's customizing the generated code.
- `OnMoon\OpenApiServerBundle\Event\CodeGenerator\GetterMethodGenerationEvent`

The GetterMethodGenerationEvent event occurs before a getter method is generated in
RequestBody/RequestParameters/Resposne DTO's
This event allows you to modify the definitions of the generated getter methods in
RequestBody/RequestParameters/Resposne DTO's customizing the generated code
- `OnMoon\OpenApiServerBundle\Event\CodeGenerator\SetterMethodGenerationEvent`

The SetterMethodGenerationEvent event occurs before a setter method is generated in
RequestBody/RequestParameters/Resposne DTO's
This event allows you to modify the definitions of the generated setter methods in
RequestBody/RequestParameters/Resposne DTO's customizing the generated code
- `OnMoon\OpenApiServerBundle\Event\CodeGenerator\ClassGraphReadyEvent`

The ClassGraphReadyEvent event occurs after all specifications
has been parsed and graph of classes to be generated has been
constructed.

This event allows you to modify:
* Class names, namespaces and paths,
* Property attributes, getters and setters,
* Base interfaces and classes.

- `OnMoon\OpenApiServerBundle\Event\CodeGenerator\FilesReadyEvent`

The FilesReadyEvent event occurs after all class files
are generated before they are written to files.

This event allows you to modify generated files content,
e.g. change code style.
Loading

0 comments on commit 6afa90b

Please sign in to comment.