Class: Raml::Schema

Inherits:
ValueNode show all
Defined in:
lib/raml/node/schema.rb

Instance Attribute Summary

Attributes inherited from ValueNode

#value

Attributes inherited from Node

#name, #parent

Instance Method Summary collapse

Methods inherited from ValueNode

#initialize

Methods inherited from Node

#initialize

Constructor Details

This class inherits a constructor from Raml::ValueNode

Instance Method Details

#json_schema?Boolean

Returns true if the schema appears to be an JSON Schema, false otherwise.

Returns:

  • (Boolean)

    true if the schema appears to be an JSON Schema, false otherwise.



6
7
8
# File 'lib/raml/node/schema.rb', line 6

def json_schema?
  /"\$schema":\s*"http:\/\/json-schema.org\/[^"]*"/ === @value
end

#xml_schema?Boolean

Returns true if the schema appears to be an XML Schema, false otherwise.

Returns:

  • (Boolean)

    true if the schema appears to be an XML Schema, false otherwise.



11
12
13
# File 'lib/raml/node/schema.rb', line 11

def xml_schema?
  /<xs:schema [^>]*xmlns:xs="http:\/\/www\.w3\.org\/2001\/XMLSchema"[^>]*>/ === @value
end