Include file not able to find
Hi,
I have a scenario like we have 2 file and its location is as below D:/raml/example.raml D:/raml/common.raml(included file in example.raml)
example.raml included common.raml, When i am parsing example.raml i am using below line of code to create RAML object
Raml raml = new RamlDocumentBuilder().build("D:/raml/example.raml");
But above line giving error saying common.raml not found. But it will work when both file keep it in classpath. but my scenario these file should not be classpath,
Please suggest me How can i fix this issue?
Aha! Link: https://mulesoft-roadmap.aha.io/features/APIRAML-128
Hi @dviru. Could you please provide the files you are talking about? Thanks.
#%RAML 0.8
title: Example API
baseUri: https://www.example.com/
protocols: [HTTPS]
schemas: !include common-schema.raml
schemas:
- person: |
{
....
}
- asset: |
{
...
}
traits: !include common-traits.raml
/example:
is: [secured]
description: Collection endpoint for example[Since:1.0]
get:
is: [getSearchResponse,pagableRequest]
description: Search example based on the given filter parameters.
headers:
Accept:
description: Media type.
example: application/json
type: string
required: true
responses:
200:
description: All examples were successfully retrieved (response collection may be empty).
body:
application/json:
schema: asset
common-schema.raml
schemas:
- getSearchResponse: |
{
...
}
Hi LorenaSoledad, Any update on this?
Hi @dviru,
I'm trying to reproduce this error, but I couldn't get to the root of the problem yet.
Let me see if I understood your problem:
You say that you are keeping both files in the same folder, right? And you parse the main file successfully, don't you? So... When does the error occur? When you move common-schemas to another folder?
Thanks.
Hi,
I am keeping both files in same folder, but this folder i am not added in java class-path. When i am trying to parse main file, i am getting include-file is not found error.
if i define include file as below in main raml file, then it will work
schemas: ! Floder-Path/include common-schema.raml
if i define include file as below then it will throw include file not found
schemas: !include common-schema.raml
Please let me know if you need further information.