Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #7500
Closed
Open
Issue created Sep 24, 2020 by Administrator@rootContributor

[BUG APEX] Code Generation in OAS.cls

Created by: henryh-force

openapi-generator/modules/openapi-generator/src/main/resources/apex/OAS.cls

If you send a response that contains anything in addition to "application/json" nothing is returned.

Set the toReturnValue to validate for more than just application/json e.g. UTF-8 within the Content Type.

@TestVisible protected virtual Object toReturnValue(String body, Type returnType, String contentType) { Original ---> if (contentType == 'application/json') { Desired ---> if (contentType.contains('application/json')) { Object o = returnType.newInstance(); if (o instanceof MappedProperties) { Map<String, String> propertyMappings = ((MappedProperties) o).getPropertyMappings(); for (String baseName : propertyMappings.keySet()) { body = body.replaceAll('"' + baseName + '"\s*:', '"' + propertyMappings.get(baseName) + '":'); } } JsonParser parser = Json.createParser(body); parser.nextToken(); return parser.readValueAs(returnType); } return body; }

Assignee
Assign to
Time tracking