Generator-jhipster: A non-working Swagger-UI related code is getting generated when using --skip-client

Created on 9 Sep 2018  路  8Comments  路  Source: jhipster/generator-jhipster

Overview of the issue

A non-working Swagger-UI related code is getting generated when using --skip-client flag while generating a JHipster project.

File: SecurityConfiguration.java

.antMatchers("/swagger-resources/configuration/ui").permitAll()
            .antMatchers("/swagger-ui/index.html").hasAuthority(AuthoritiesConstants.ADMIN)
Suggestion

When the --skip-client is used, either we should support the Swagger-UI or remove the non-working Swagger-UI related code.

JHipster configuration

$ jhipster info
Using JHipster version installed globally
Executing jhipster:info
Options:
Welcome to the JHipster Information Sub-Generator

JHipster Version(s)
[email protected] E:\workspace\sts_workspace\CalorieCounterBackend
`-- (empty)

##### **JHipster configuration, a `.yo-rc.json` file generated in the root folder**
.yo-rc.json file
{
  "generator-jhipster": {
    "promptValues": {
      "packageName": "com.example",
      "nativeLanguage": "en"
    },
    "jhipsterVersion": "4.14.3",
    "baseName": "CalorieCounterBackend",
    "packageName": "com.example",
    "packageFolder": "com/example",
    "serverPort": "8080",
    "authenticationType": "jwt",
    "cacheProvider": "no",
    "enableHibernateCache": false,
    "websocket": false,
    "databaseType": "mongodb",
    "devDatabaseType": "mongodb",
    "prodDatabaseType": "mongodb",
    "searchEngine": false,
    "messageBroker": false,
    "serviceDiscoveryType": false,
    "buildTool": "maven",
    "enableSocialSignIn": false,
    "enableSwaggerCodegen": false,
    "jwtSecretKey": "replaced-by-jhipster-info",
    "enableTranslation": true,
    "applicationType": "monolith",
    "testFrameworks": [],
    "jhiPrefix": "jhi",
    "nativeLanguage": "en",
    "languages": [
      "en",
      "de"
    ],
    "clientPackageManager": "yarn",
    "skipClient": true
  }
}

JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory


JDL entity definitions





Environment and Tools

java version "1.8.0_172"
Java(TM) SE Runtime Environment (build 1.8.0_172-b11)
Java HotSpot(TM) Client VM (build 25.172-b11, mixed mode, sharing)

git version 2.12.2.windows.2

node: v8.11.4

npm: 6.4.0

yarn: 1.3.2

Docker version 18.03.0-ce, build 0520e24302

docker-compose version 1.20.1, build 5d8c71b2

Congratulations, JHipster execution is complete!

wont-fix

Most helpful comment

IMO, We should have the SwaggerUI even for the backend-only code as it makes exploring the API way easier than using some third-party tool.

I know that we can export the swagger JSON via the URL /v2/api-docs but even after that, it is not a seamless experience to import that JSON data with the external SwaggerUI. There are issues like CORS, unreachable API because of the localhost deployment etc.

All 8 comments

@yatendragoel Would you be interested in creating a PR for this? Please go ahead 馃憤

@sendilkumarn Sure. Just wanted to discuss which approach would be suitable: "Supporting Swagger-UI" for --skip-client or "Removing Swagger-UI related code"?

IMO It would be meaningless to have this when the entire UI is skipped

IMO, We should have the SwaggerUI even for the backend-only code as it makes exploring the API way easier than using some third-party tool.

I know that we can export the swagger JSON via the URL /v2/api-docs but even after that, it is not a seamless experience to import that JSON data with the external SwaggerUI. There are issues like CORS, unreachable API because of the localhost deployment etc.

I agree with @yatendragoel and this is what we do at work for all our microservices.

+1

There is still one valid case to keep it and it is when using the skip-client option to generate the back-end and front-end separately.

Let's leave it as it is as its still useful when splitting your server and client

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lsadehaan picture lsadehaan  路  3Comments

RizziCR picture RizziCR  路  3Comments

SudharakaP picture SudharakaP  路  3Comments

Steven-Garcia picture Steven-Garcia  路  3Comments

frantzynicolas picture frantzynicolas  路  3Comments