Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,14 @@ private void processDiscriminatorAsRefProperty(RefProperty subRef, String extern
private void processRefProperty(RefProperty subRef, String externalFile) {

if (isAnExternalRefFormat(subRef.getRefFormat())) {

String joinedRef = join(externalFile, subRef.get$ref());
subRef.set$ref(processRefToExternalDefinition(joinedRef, subRef.getRefFormat()));
String processRef = processRefToExternalDefinition(joinedRef, subRef.getRefFormat());
if(processRef.startsWith("http") || processRef.startsWith("https:")) {
subRef.set$ref(processRef);
}else {
subRef.set$ref(RefType.DEFINITION.getInternalPrefix()+processRef);
}
} else {
String processRef = processRefToExternalDefinition(externalFile + subRef.get$ref(), RefFormat.RELATIVE);
subRef.set$ref(RefType.DEFINITION.getInternalPrefix()+processRef);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ public void testIssueRelativeRefs2(){
assertEquals(refProperty.get$ref(),"#/definitions/simpleIDType_v01");
}

@Test
public void testIssueDefinitionWithDots() {
Swagger swagger = new SwaggerParser().read("API-Service-2.0.0-swagger.yaml");
assertNotNull(swagger);
}

@Test
public void testIssue927() {
Swagger swagger = new SwaggerParser().read("issue-927/issue-927.yaml");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
swagger: '2.0'
info:
version: "2.0.0"
title: 'Service Domain'
basePath: /service

# Mock end-point
host: what.ever.ok.ok

schemes:
- https
#/Global Definitions.

paths:
'/update-identification':
post:
tags:
- Company actions
summary: Update Company identification
description: Update the identification details for a company object
operationId: >-
ByContractcodeByBusinessunitV1CompaniesByCompanyIdUpdate-identificationPost
consumes:
- application/json-patch+json
- application/json
- text/json
- application/*+json
produces: []
parameters:
- name: companyId
in: path
description: Company Id
required: true
type: string
- name: payload
in: body
description: Company identification
required: false
schema:
$ref: >-
Domain1.yaml#/definitions/Company.CompanyIdentificationPayload
- name: contractcode
in: path
description: Contract code
required: true
type: string
x-example: sample
- name: businessunit
in: path
description: Business unit
required: true
type: string
x-example: sample
responses:
'200':
description: Success
'/{contractcode}/{businessunit}/v2/repair-orders/{repairOrderId}/jobs':
post:
tags:
- Repair order item actions
summary: Create Repair order item
description: Create a repair order item object
operationId: ByContractcodeByBusinessunitV2Repair-ordersByRepairOrderIdJobsPost
consumes:
- application/json-patch+json
- application/json
- text/json
- application/*+json
produces:
- text/plain
- application/json
- text/json
parameters:
- name: repairOrderId
in: path
description: repairOrderId
required: true
type: string
- name: repairOrderJob
in: body
description: Repair order item
required: false
schema:
$ref: 'Domain2.yaml#/definitions/RepairOrder.RepairOrderJobDetails'
- name: contractcode
in: path
description: Contract code
required: true
type: string
x-example: sample
- name: businessunit
in: path
description: Business unit
required: true
type: string
x-example: sample
responses:
'201':
description: Success
schema:
$ref: Domain2.yaml#/definitions/RepairOrder.RepairOrderJobResponse201
28 changes: 28 additions & 0 deletions modules/swagger-parser/src/test/resources/Domain1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
### Domain

info:
description: "Platform Domain"
version: '1.0.0'
title: 'Platform Domain'

definitions:
Company.CompanyIdentification:
type: object
properties:
name:
type: string
languageCode:
type: string
taxRegistration:
type: string
businessRegistration:
type: string
governmentRegistration:
type: string
Company.CompanyIdentificationPayload:
type: object
properties:
identification:
$ref: >-
#/definitions/Company.CompanyIdentification
#end of spec
41 changes: 41 additions & 0 deletions modules/swagger-parser/src/test/resources/Domain2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
### Service Domain

info:
description: "CDK Open Platform Domain : Service"
version: "2.0.0"
title: 'CDK Open Platform Domain : Service'

definitions:
RepairOrder.RepairOrderJobDetails:
description: RepairOrderJobDetails use for Create and Get RepairOrderJob
type: object
properties:
jobId:
description: Job Id
type: string
jobType:
description: Job type
enum:
- SCHEDULED_MAINTENANCE
- GOVERNMENT_INSPECTION
- REPAIR
- OTHER
type: string
jobSource:
description: Job Source
enum:
- WORKSHOP
- VHC
- CUSTOMER_REQUEST
- MANUFACTURER
- OTHER
type: string
description:
description: Description
type: string
RepairOrder.RepairOrderJobResponse201:
description: RepairOrderJobResponse201
type: object
properties:
jobId:
type: string