Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MSF4J] Add generator for WSO2 Microservices Framework (MSF4J) #4056

Merged
merged 1 commit into from
Oct 26, 2016

Conversation

sanjeewa-malalgoda
Copy link
Contributor

@sanjeewa-malalgoda sanjeewa-malalgoda commented Oct 24, 2016

PR checklist

  • Read the contribution guildelines.
  • Ran the shell/batch script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates)
  • Filed the PR against the correct branch: master for non-breaking changes and 2.3.0 branch for breaking (non-backward compatible) changes.

Description of the PR

(details of the change, additional tests that have been done, reference to the issue for tracking, etc)

@sanjeewa-malalgoda
Copy link
Contributor Author

This commit is to provide MSF4J(https://github.com/wso2/msf4j) support for swagger code generator. However ./bin/{LANG}-petstore.sh did not added as this is entirely new framework. Please let me know if anything need. I tried different swagger definitions including pet store and everything worked smoothly for me. Thank you all.

@wing328
Copy link
Contributor

wing328 commented Oct 24, 2016

@sanjeewa-malalgoda thank you for your contribution. I'll review and let you know if I've any question.

@sanjeewa-malalgoda
Copy link
Contributor Author

Also following text need to add documents section and it explains how we can generate code and run micro service.

Java Micro Services Framework For Java
MSF4J generator uses java-msf4j as the default library
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate
-i http://petstore.swagger.io/v2/swagger.json
-l msf4j
-o samples/server/petstore/msf4j

Before you build/run service replace .deploy(new PetApi()) with your actual service class name in Application.java file like .deploy(new ApisAPI()) then it will start that service. If you have multiple service classes add them in , separated manner.

    new MicroservicesRunner()
            .deploy(new PetApi())
            .start();
}

To Use-it : in the generated folder try mvn package for build jar.
Start your server java -jar target/micro-service-server-1.0.0.jar
Java Microservice listening on default port 8080

Run the following command or simply go to http://127.0.0.1:8080/pet/12 from your browser.
curl http://127.0.0.1:8080/pet/12


public JavaMSF4JServerCodegen() {
super();
outputFolder = "generated-code/JavaJaxRS-Jersey";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we set outputFolder to "generated-code/JavaMS4J" instead?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I found some other Java server stub generators do not have proper outputFolder set.

I'll file a PR to clean those up (including this one)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI. #4076 submitted

@wing328 wing328 merged commit 80bb564 into swagger-api:master Oct 26, 2016
@wing328
Copy link
Contributor

wing328 commented Oct 26, 2016

@wing328
Copy link
Contributor

wing328 commented Oct 26, 2016

Tweet: https://twitter.com/wing328/status/791132415762784256

To all, please help retweet to promote the new generator.

@sanjeewa-malalgoda
Copy link
Contributor Author

Thank you very much @wing328. It was great pleasure to work in this project and i hope to contribute further in future.

@wing328
Copy link
Contributor

wing328 commented Oct 26, 2016

@sanjeewa-malalgoda Looking forward to your contributions in the future.

Btw, I've added you as the template owner of MSF4J in https://github.com/swagger-api/swagger-codegen/blob/master/README.md#template-creator

@wing328 wing328 changed the title Introducing swagger MSF4J support for swagger code generator [MSF4J] Add generator for WSO2 Microservices Framework (MSF4J) Feb 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants