Coder Social home page Coder Social logo

open-api-spec's Introduction

Open API Specification - Swagger 3

This is a demo project to understand basic implementation of Open API Specification. The Swagger UI will be configured and rendered.

The blog URL OpenAPI Specification โ€” Swagger UI

Swagger UI for API Specification

Swagger UI v3 provides a display framework that reads API specification document and generates an interactive documentation website.

Below URL can be used to access Swagger UI when the spring-boot application is run locally. Swagger UI endpoint can be customized via application.properties file. This will be described in later sections.

Localhost Swagger UI

Default API Endpoint

On systems running the API, it is recommended to use the below port for starting an API instance.

10001 - default api listening port

API Build & deploy from GIT repository

Below section would cover tasks required to configure and deploy api jar

  1. Clone repo on local system. By default, jars would be taken from Maven Central Repository
  2. Update properties in logback-spring.xml, application.properties if required.
  3. Build the project using Maven command mvn clean install
  4. Copy .jar file created in /project-directory/target/ to deployment-directory
  5. Environment specific application.proeprties & logback-spring.xml files if modified, then they are to be placed in deployment-directory along with the jar file.
  6. Start the jar execution with command java -jar <project-name>-<version>.jar

    eg: java -jar open-api3-0.0.1-SNAPSHOT.jar

  7. Logs are generated in /deployment-directory/logs/ folder or as mentioned in logback-spring.xml file

Configure application.properties

Below section describes how to configure application.properties file to override the default values.

  • Spring Boot Server Port

    server.port=10001

  • Spring Boot Application name

    spring.application.name=open-api-demo

  • Spring Boot Application Context path

    spring.servlet.context-path=/open-api-demo

  • Open API Configuration Properties

    openapi.title=Open API Demo
    openapi.version=v1.0.0
    openapi.description=Swagger UI using Open API Specification

  • Default Open API endpoint Specifications

    • api docs endpoint path

      springdoc.api-docs.path=/v3/api-docs

    • customise endpoint for Swagger UI

      springdoc.swagger-ui.path=/swagger-ui.html

    • disable default petstore Swagger

      springdoc.swagger-ui.disable-swagger-default-url=true

open-api-spec's People

Contributors

sourabhparsekar avatar

Stargazers

 avatar

Watchers

 avatar

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.