Skip to content

Commit

Permalink
fixes #312 update openapi readme template for maven command line (#313)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevehu authored May 30, 2019
1 parent 93866c6 commit 5e90a99
Showing 1 changed file with 36 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,27 +1,54 @@
# Swagger Light Java Server
# OpenAPI Light-4J Server

## Start server
## Build and Start

Run with
For testing locally, you don't need to create the artifact for the document, source code, and the fatjar. You can build and start the server with the following command.

```
mvn package exec:exec
``
mvn clean install exec:exec
```

or

```
mvn clean package exec:exec
```

If you want to build the fatjar and other artifacts, please use the following command.

```
mvn clean install -Prelease
```

With the fatjar in the target directory, you can start the server with the following command.

```
java -jar target/fat.jar
```

## Test

By default, all endpoints are protected by OAuth jwt token verifier. It can be turned off with config change through for development.
By default, the OAuth2 JWT security verification is disabled. You can use Curl or Postman to test your service right after the code generation. For example,


```
curl -k https://localhost:8443/v1/pets
```


In order to access the server, there is a long lived token below issued by my
## Security

The OAuth JWT token verifier protects all endpoints, but it is disabled in the generated openapi-security.yml config file. If you want to turn on the security, change the src/main/resources/config/openapi-security.yml enableVerifyJwt to true and restart the server.


To access the server, there is a long-lived token below issued by my
oauth2 server [light-oauth2](https://github.com/networknt/light-oauth2)

```
Bearer eyJraWQiOiIxMDAiLCJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJ1cm46Y29tOm5ldHdvcmtudDpvYXV0aDI6djEiLCJhdWQiOiJ1cm46Y29tLm5ldHdvcmtudCIsImV4cCI6MTc5MDAzNTcwOSwianRpIjoiSTJnSmdBSHN6NzJEV2JWdUFMdUU2QSIsImlhdCI6MTQ3NDY3NTcwOSwibmJmIjoxNDc0Njc1NTg5LCJ2ZXJzaW9uIjoiMS4wIiwidXNlcl9pZCI6InN0ZXZlIiwidXNlcl90eXBlIjoiRU1QTE9ZRUUiLCJjbGllbnRfaWQiOiJmN2Q0MjM0OC1jNjQ3LTRlZmItYTUyZC00YzU3ODc0MjFlNzIiLCJzY29wZSI6WyJ3cml0ZTpwZXRzIiwicmVhZDpwZXRzIl19.mue6eh70kGS3Nt2BCYz7ViqwO7lh_4JSFwcHYdJMY6VfgKTHhsIGKq2uEDt3zwT56JFAePwAxENMGUTGvgceVneQzyfQsJeVGbqw55E9IfM_uSM-YcHwTfR7eSLExN4pbqzVDI353sSOvXxA98ZtJlUZKgXNE1Ngun3XFORCRIB_eH8B0FY_nT_D1Dq2WJrR-re-fbR6_va95vwoUdCofLRa4IpDfXXx19ZlAtfiVO44nw6CS8O87eGfAm7rCMZIzkWlCOFWjNHnCeRsh7CVdEH34LF-B48beiG5lM7h4N12-EME8_VDefgMjZ8eqs1ICvJMxdIut58oYbdnkwTjkA
```

Postman is the best tool to test REST APIs

Add "Authorization" header with value as above token and a dummy message will return from the generated stub.



0 comments on commit 5e90a99

Please sign in to comment.