raml-java-parser icon indicating copy to clipboard operation
raml-java-parser copied to clipboard

Include file not able to find

Open dviru opened this issue 9 years ago • 5 comments

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

dviru avatar Aug 02 '16 12:08 dviru

Hi @dviru. Could you please provide the files you are talking about? Thanks.

LorenaSoledad avatar Aug 02 '16 17:08 LorenaSoledad

#%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: |
       {
          ...
       }

dviru avatar Aug 03 '16 05:08 dviru

Hi LorenaSoledad, Any update on this?

dviru avatar Aug 08 '16 10:08 dviru

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.

LorenaSoledad avatar Aug 11 '16 18:08 LorenaSoledad

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.

dviru avatar Aug 11 '16 18:08 dviru