RapiPdf
RapiPdf copied to clipboard
Examples missing?
When rendering out the PDF I seem to only get the model data from my OpenAPI v3 document. I'm not seeing the examples. Any reason why no examples shown?
the only reason is that we couldn't reach any consensus within our team to implement it and the way to display it.
Are you looking for curl command, code snippet or just some sample values based on data-types ? If you can provide me some samples (pdfs/word doc) based on your needs covering most possible data-types and scenarios then I can re-open this discussion
Let's say we have the following schema defined:
components:
schemas:
rider:
type: object
description: A registered rider.
properties:
id:
type: integer
format: int64
description: The external rider id.
example: 12345
lastName:
type: string
example: Pan
firstName:
type: string
example: Peter
required:
- id
- lastName
example:
id: 12345
lastName: Pan
It would be helpful to show the example for each individual property as well as the example for the entire schema. Note that the example for the schema might not include non-required properties.
We added examples in our roadmap, and it will work exactly the way you explained above. The issues that we face now is, some spec even without any example can generate 1000 pages, including example would almost double that number and may create memory overflows.
We may introduce this feature behind a property or also thinking of making it cli
based. Expect some traction on this in Q1 of 2020
Is it possible to add a template parameter to control whether examples are included or not? E.g.
<template>
{
"includeExamples" : "true",
}
</template>
In release 2.1.1
use include-example
attribute to include examples in the generated PDF. As of now this feature is limited to Request parameters. Request body and Response Body examples will follow later
Request body and Response Body examples will follow later
When will this be? We would need this feature.
This is a big feature as there are certain complex scenarios on how examples can be specified in an OpenAPI spec.
Currently we are rolling various example support in RapiDoc
we are going to wait, collect feedback, and stabilize it further if needed. Only after that we are going to add example feature in RapiPDF
Please see PR https://github.com/mrin9/RapiPdf/pull/68
Been two years since PR addressing this issue was accepted. Should this issue still be open?
The latest code doesn't seem to render the examples correctly.
For an OpenApi v3.0 JSON schema, only the top level node is printed for all examples. https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.0/api-with-examples.json
For an OpenApi v2 JSON schema, "response" is printed for all examples. https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v2.0/json/api-with-examples.json