Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Dec 14 02:40

    stevehu on master

    fixes issue #625 (#626) (compare)

  • Dec 14 02:39
    stevehu commented #625
  • Dec 14 02:39
    stevehu commented #625
  • Dec 14 02:38

    stevehu on issue_625

    (compare)

  • Dec 14 02:38

    stevehu on 1.6.x

    fixes issue #625 (#626) (compare)

  • Dec 14 02:38
    stevehu closed #626
  • Dec 14 02:33

    stevehu on master

    Due to large impact of making i… (compare)

  • Dec 14 02:32

    stevehu on makeClientSSLdeprecated

    (compare)

  • Dec 14 02:32

    stevehu on 1.6.x

    Due to large impact of making i… (compare)

  • Dec 14 02:32
    stevehu closed #631
  • Dec 14 00:16
    miklish review_requested #631
  • Dec 14 00:11
    miklish opened #631
  • Dec 14 00:08

    miklish on makeClientSSLdeprecated

    Due to large impact of making i… (compare)

  • Dec 13 23:40
    miklish commented #630
  • Dec 13 22:56
    miklish commented #630
  • Dec 13 22:55
    miklish commented #630
  • Dec 13 22:43
    miklish commented #630
  • Dec 13 22:25
    stevehu commented #630
  • Dec 13 22:18
    miklish commented #630
  • Dec 13 22:09
    stevehu commented #629
Steve Hu
@stevehu
@Daemach Let's discuss in a private channel.
Relivian
@Relivian
I don't know whether the code coverage badge has always been in the light-4j repo, I just noticed it. The numbers are pretty impressive and a great indicator for code maintenance and quality.
Steve Hu
@stevehu
It is been there for a long time. We have been enforcing test cases for the PRs these days but there are still a lot of room to improve :)
Relivian
@Relivian
Anyway, kudos to the whole team. I wish more projects were like this. It's also a good reminder to clean up own stuff ;)
Relivian
@Relivian
Thankfully I just found that little yet entertaining anecdote about this topic again that, in my opinion, describes the matter perfectly:
https://stackoverflow.com/a/90021
Have fun!
Steve Hu
@stevehu
funny answers :) Percentage is not the answer. I think we just need enough coverage to ensure that subsequent changes won't break the application.
David Lau
@davidopluslau
Hi! We're running graphQL and REST side by side. Our REST API gzips, but our graphQL API doesn't. We looked up and down each handler chain and couldn't figure out where the REST chain gzips and how to port that into graphQL. Could you help us with gzip for graphQL?
Bastian Kuberek
@bkuberek
basically we have a hybrid light-4j server that has both rest and graphql endpoints and we want to add gzip encoding. We double checked and the statement above is incorrect, neither rest or graphql are encoding. We would like to add EncodingHandler to the handler chain in handler.yml
Steve Hu
@stevehu
@bkuberek is right. You need to wire in the encoder/decoder in the client and server to enable gzip. https://github.com/networknt/light-4j/tree/master/encode-decode
Bastian Kuberek
@bkuberek
thank you!
chriswang-
@chriswang-
I just run the light-oauth2 in docker-toolbox, but none of the images have been started, it mentioned: "no route handler provider available in service.yml"
What'is the problem is?
Steve Hu
@stevehu
@chriswang- I remember this question was asked before so I moved it to the stackoverflow to make it easier to be searched. Please see my answer at https://stackoverflow.com/questions/58946055/when-starting-light-oauth2-images-it-shows-no-route-handler-provider-available/58946056#58946056
chriswang-
@chriswang-
COOL, Thx Steve, I am new poeple into the light, I found the idea of light is cool, and the community is really active, I hop that I can use your framework finaly and make my own contribute for community.
@stevehu
Steve Hu
@stevehu
@chriswang- welcome to the community. Let us know if you have any questions. The platform is an ecosystem for enterprise and it takes some effort to understand. So don't hesitate to ask questions.
chriswang-
@chriswang-
@stevehu , If It is possible by using the light-oauth2 as a real oauth2 provider? I am going to run my app in the spring boot as a Resource Server and communicating with light-oauth2, but it seems that I cannt find url which looks like : /.well-known/open-configuration. How to cope with my situation ? can you give me some tutorial or sample project to reference?
Steve Hu
@stevehu
@chriswang- It is absolutely possible to use it as a real OAuth 2.0 provider and the implementation is following the specification. One enterprise customer even switches between light-oauth2 and CA layer 7 from SIT/UAT to PROD with only the configuration change. For services implemented with light-4j, the interaction to the light-oauth2 is handled by the Http2Client already via configuration only in most of the cases. Every OAuth 2.0 implementation will have different endpoints and they are all defined in the client.yml file. The following is the built-in example.
For more information on how to use it, you can follow the tutorial.
The OAuth 2.0 was designed for monolithic and we have added too many extensions to meet the requirement for microservices. Please be aware of the differences.
chriswang-
@chriswang-
@stevehu Thx, I will give it try.
Steve Hu
@stevehu

We have released 1.6.11 for jdk8 and 2.0.8 for jdk11 as scheduled. Both releases are backward compatible with some defects addressed, and some enhancements added.

For more all the PRs included in each release, please visit https://trello.com/b/189msq9S/release-schedule or individual release note.

favalos
@favalos
Hi, we are planning to use the json schema validator for our project. What is the best way to validate the schema is valid against the V7 Schema Core? We are not trying to validate instances, in our system the user can create their own schema, but we need to be sure it is valid.
Steve Hu
@stevehu
@favalos JSON schema is just a JSON object that follows the specifications and you use the meta schema to validate it. This links to the draftv4 meta schema https://github.com/networknt/json-schema-validator/blob/master/src/main/resources/draftv4.schema.json
favalos
@favalos
@stevehu Great, thanks for your prompt response. Working on it.
favalos
@favalos
 public static final void main(String[] args) {

        ObjectMapper mapper = new ObjectMapper();

        String str = "{\n" +
                "  \"type\": \"object\",  \n" +
                "  \"properties\": {\n" +
                "    \"first_name\": { \"type\": \"string\" },\n" +
                "    \"last_name\": { \"type\": \"string\" },\n" +
                "    \"birthday\": { \"type\": \"string\", \"format\": \"ate\" },\n" +
                "    \"address\": {\n" +
                "      \"type\": \"object\",\n" +
                "      \"properties\": {\n" +
                "        \"street_address\": { \"type\": \"string\" },\n" +
                "        \"city\": { \"type\": \"string\" },\n" +
                "        \"state\": { \"type\": \"string\" },\n" +
                "        \"country\": { \"type\" : \"string\" }\n" +
                "      },\n" +
                "      \"additionalProperties\": false\n" +
                "    }\n" +
                "  },\n" +
                "    \"additionalProperties\": false\n" +
                "}";


        JsonSchemaFactory schemaFactory = JsonSchemaFactory.builder(JsonSchemaFactory.getInstance(SpecVersion.VersionFlag.V7)).build();
        JsonSchema jsonSchema = null;
        try {
            jsonSchema = schemaFactory.getSchema(new URI("https://json-schema.org/draft-07/schema#"));
        } catch (URISyntaxException e) {
            e.printStackTrace();
        }

        JsonNode jsonNode = null;
        try {
            jsonNode = mapper.readTree(str);
        } catch (JsonProcessingException e) {
            e.printStackTrace();
        }
        Set<ValidationMessage> validationMessageSet = jsonSchema.validate(jsonNode);

        System.out.println(validationMessageSet.size());
    }
Hi, I am using the code above to test the schema, but for the birthday I intentionally set the format to "ate" instead of "Date" but for some reason I am not getting any error message. Is this expected?
Steve Hu
@stevehu
Interesting question :) You need to take a look at the meta schema to figure out how it is written against the format. In my opinion, it should be an enum but you never know.
After validate with some online validator. Yes. It is the correct behavior.
{
"type": "object",
"properties": {
"birthday": {
"type": "string",
"format": "ate"
}
}
}
favalos
@favalos
You are right, I tried with a validator on line and the schema is valid with "ate".
Thank you @stevehu
Steve Hu
@stevehu
Over the weekend, I have upgraded the react-schema-form and react-schema-from-rc-select and build and deployed a light-reference API mock to support the SPA application. I hope it helpful for users who are working on both front-end and backend. https://doc.networknt.com/tutorial/rest/openapi/light-reference/
shuchigupta
@shuchigupta
Hi, I'm setting up a new project in light4j using maven as build tool. I have business logic that should execute asynchronously, and I plan to use Java CompletableFuture for it. What I want to understand is that when building my light 4j application, does the server artifact take care of instantiating ForkJoinPool (I'm assuming that is the default thread pool which will be used in absence of specifying a thread pool), or is there some other artifact that I need to include in pom for this purpose?
Steve Hu
@stevehu
@shuchigupta The light-4j is built async to handle the high throughput. It has an event loop for IO request and then the request can be dispatch to the worker pool. For developers, you just need to put the business logic into the handler handleRequest and it will be executed asynchronously. We also have Http2Client which is working the same way and it supports CompletableFuture to invoke other services.
shuchigupta
@shuchigupta
@stevehu Thanks for the prompt reply. Actually, I need to asynchronously execute business logic inside a microservice. I understand that the microservice is exposed through Rest and that is handled asynchronously via the handler. But how about internal classes inside the microservice wanted to execute a piece of code asynchronously?
Steve Hu
@stevehu
@shuchigupta You can use completablefuture in your business logic. For example, when you call another service in your business logic and that is the Http2Client kicks in.
shuchigupta
@shuchigupta
@stevehu So the CompletableFuture will use the same worker thread pool?
Steve Hu
@stevehu
If you are using the Http2Client, the completableFuture will use the client worker thread pool.
shuchigupta
@shuchigupta

I'm sorry if not able to put across my question properly. Maybe this sequence diagram might help. Client -> Service A -> Business Logic (Service A)

API Request invoking Service A is using the worker thread pool since the request is channeled through HttpHandler. If Service A was calling another Service B, then it would be using Http2Client which would also use the same thread pool. But if the internal classes of Service A not invoking any other Service through Http2 but only wanting to use CompletableFuture for doing very small internal microservice tasks, then which thread pool would be used here?

Steve Hu
@stevehu
In this case, you can specify your own thread pool, otherwise, the common thread pool will be used.
shuchigupta
@shuchigupta
@stevehu Great. Thanks!
shuchigupta
@shuchigupta

Hi @stevehu I am building a Rest Project with light-rest-4j. I've made a openapi-validator.yml which has enabled set to true. I have also made a file openapi.json which has API request/response structures as per OpenAPI spec.

Right now, I'm not able to use the ValidatorHandler to validate my API request structure. Should my handler class inherit ValidatorHandler to invoke validation? I could not find much documentation/example how to use Validator.

Please help.

Steve Hu
@stevehu
Are you generating the project with light-codegen? If yes, the ValidatorHandler should be wired in already and enabled by default. We normally use openapi.yaml instead of openapi.json as it is more readable.
Steve Hu
@stevehu
This is the petstore tutorial that might help. https://doc.networknt.com/tutorial/rest/openapi/petstore/
shuchigupta
@shuchigupta
@stevehu Thanks a lot. It worked.