Giter Site home page Giter Site logo

Comments (4)

meztez avatar meztez commented on June 8, 2024

You can edit the spec to match your requirement https://www.rplumber.io/reference/pr_set_api_spec.html.

from plumber.

apriandito avatar apriandito commented on June 8, 2024

ahh i see just in case someone have same problem like me. here some reference.

pr() %>%
  pr_set_api_spec(function(spec) {
    spec$info$title <- "Nama API"
    spec$info$description <- "Deskripsi API"
    spec$info$termsOfService <- "https://contoh.com/tos"
    
    # Set response schema for /hello
    spec$paths$`/hello`$get$responses$`200`$content$`application/json`$schema <- list(type = "string")
    
    # Set response schema for /add
    spec$paths$`/add`$post$responses$`200`$content$`application/json`$schema <- list(type = "number")
    
    spec$paths$`/hello`$get$operationId <- "hello_world"
    spec$paths$`/add`$post$operationId <- "add_numbers"
    spec
  }) %>%
  pr_get("/hello", function(req) {
    "Hello World!"
  }) %>%
  pr_post("/add", function(req) {
    as.numeric(req$POST$body$a) + as.numeric(req$POST$body$b)
  }) %>%
  pr_run(port = 8000)

from plumber.

meztez avatar meztez commented on June 8, 2024

Add operationId to generated spec:
https://spec.openapis.org/oas/latest.html#fixed-fields-7

from plumber.

Related Issues (20)

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.