[BUG][HTML] Vendor-specific media type breaks Example Data
Created by: john3300
Description
Using a vendor-specific media type causes the Example data
section of the operation listing to be empty. Vendor-specific media types are fully supported by OpenAPI Spec 3.0 according to the 'Media Type Names' section on this page: https://swagger.io/docs/specification/media-types/
openapi-generator version
4.0.0-SNAPSHOT
OpenAPI declaration file content or url
openapi: 3.0.0
info:
title: Test
description: Test YAML
version: '1.0'
servers:
- url: http://localhost
paths:
/employees/{id}:
get:
operationId: getEmployeeById
parameters:
- name: id
in: path
required: true
schema:
type: string
responses:
200:
description: Success
content:
application/vnd.john3300+json;version=1.0:
schema:
$ref: '#/components/schemas/employee'
components:
schemas:
employee:
type: object
properties:
name:
type: string
required:
- name
Command line used for generation
java -jar openapi-generator-cli-4.0.0-20181217.102953-101.jar generate -g html -i test.yaml
Related issues/PRs
None that I've seen.
Suggest a fix
The code to generate these example sections needs to use a regex to be able to correctly parse these vendor-specific media types and also any additional parameters (e.g. `;version=1.0) that are present.