Giter VIP home page Giter VIP logo

java-explore-with-me's People

Contributors

kriulkin avatar

Watchers

 avatar

java-explore-with-me's Issues

fix: incorrect code generation by swagger-codegen-maven-plugin

In case of code generation via swagger-codegen-maven-plugin there are problems with escaping some quote symbols in the sources generated. This causes compilation errors.
The following plugin settings are used for repro:

    <build>
        <plugins>
            <plugin>
                <groupId>io.swagger.codegen.v3</groupId>
                <artifactId>swagger-codegen-maven-plugin</artifactId>
                <version>3.0.41</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <inputSpec>${project.basedir}/../ewm-main-service-spec.json</inputSpec>
                            <language>spring</language>
                            <library>spring-boot</library>
                            <apiPackage>${apiPackage}</apiPackage>
                            <modelPackage>${modelPackage}</modelPackage>
                            <configOptions>
                                <sourceFolder>src/main/java/</sourceFolder>
                                <dateLibrary>java8</dateLibrary>
                                <interfaceOnly>true</interfaceOnly>
                                <useBeanValidation>true</useBeanValidation>
                                <performBeanValidation>true</performBeanValidation>
                            </configOptions>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

See the whole demo pom.xml in terekhovmv/java-explore-with-me-fixes@da018e0 .

This issue is not reproduced for specs of stats service.

refactor: corrects operationIds in ewm service specs

Prerequisite: It is highly recommended to merge yandex-praktikum/java-explore-with-me#22 changes, since generation via swagger-codegen-maven-plugin does not work correctly for original ewm-main-service-spec.json file.

In case of code generation via swagger-codegen-maven-plugin there are several problems with operationIds provided in ewm-main-service-spec.json file (see demo pom.xml in terekhovmv/java-explore-with-me-fixes@da018e0).

  1. Some of operationIds contain numeric suffixes, and this suffixes appear in methods of generated *Api interfaces (getEvents_2, getEvent_1). Solution: remove suffixes at least.
  2. There is no consistency in naming (delete / deleteCompilation, registerUser / addEvent / saveCompilation). Solution: provide consistent naming.
  3. Since *Api interfaces are generated for top level endpoint components (/users/* => UsersApi) there are problems with identifying endpoint methods for different roles (e.g. cancelRequest and changeRequestStatus in the UsersApi interface). Solution: put the role as prefix in operationIds.
  4. Since operationIds must be unique among all operations described in your API (see https://swagger.io/docs/specification/paths-and-operations/), we should provide enough global descriptive names (delete or getEvent_1 does not work).

Tabular view of changes proposed in this PR:

Method Original operationId Recommended operationId
PUBLIC
GET /categories getCategories getCategories (no changes)
GET /categories/{catId} getCategory getCategory (no changes)
GET /compilations getCompilations getCompilations (no changes)
GET /compilations/{compId} getCompilation getCompilation (no changes)
GET /events getEvents_1 findEvents
GET /events/{id} getEvent_1 getEvent
ADMIN
GET /admin/users getUsers adminGetUsers
POST /admin/users registerUser adminAddUser
DELETE /admin/users/{userId} delete adminRemoveUser
POST /admin/categories addCategory adminAddCategory
DELETE /admin/categories/{catId} deleteCategory adminRemoveCategory
PATCH /admin/categories/{catId} updateCategory adminUpdateCategory
GET /admin/events getEvents_2 adminFindEvents
PATCH /admin/events/{eventId} updateEvent_1 adminUpdateEvent
POST /admin/compilations saveCompilation adminAddCompilation
DELETE /admin/compilations/{compId} deleteCompilation adminRemoveCompilation
PATCH /admin/compilations/{compId} updateCompilation adminUpdateCompilation
INITIATOR
GET /users/{userId}/events getEvents initiatorGetEvents
GET /users/{userId}/events/{eventId} getEvents initiatorGetEvent
POST /users/{userId}/events addEvent initiatorAddEvent
PATCH /users/{userId}/events/{eventId} updateEvent initiatorUpdateEvent
GET /users/{userId}/events/{eventId}/requests getEventParticipants initiatorGetEventRequests
PATCH /users/{userId}/events/{eventId}/requests changeRequestStatus initiatorChangeRequestStatus
PARTICIPANT
GET /users/{userId}/requests getUserRequests participantGetRequests
POST /users/{userId}/requests addParticipationRequest participantAddRequest
PATCH /users/{userId}/requests/{requestId}/cancel cancelRequest participantCancelRequest

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.