Showing posts with label decimal. Show all posts
Showing posts with label decimal. Show all posts

Tuesday, May 23, 2017

Swagger doesn't support decimal

As of version 7.10.0 using node.js the swagger doesn't support the decimal however it supports the number of type float of 32 bit, double of 64 bit but not decimal of 128 bit.

So you can declare as a field of type decimal as below..

  "amount" : {
          "type" : "number"


Then cast it to decimal like CAST(amount AS DECIMAL);

Friday, November 4, 2016

Allow empty element for decimal type in XSD

Using nillable="true" on the element declaration is half-way there;
you also need to add xsi:nil="true" on the empty element itself, in
the instance document. For example, if you have the declaration:

<xs:element name="foo" type="xs:decimal" nillable="true" />

then the following are valid:

<foo>12.5</foo>
<foo xsi:nil="true" />

but the following are invalid:

<foo>bar</foo>
<foo />

If you want to avoid using xsi:nil to mark such elements, then you
should define a new datatype that allows elements to either have a
decimal value or have an empty string as their value, like this:

<xs:simpleType name="decimal-or-empty">
  <xs:union memberTypes="xs:decimal empty-string" />
</xs:simpleType>

<xs:simpleType name="empty-string">
  <xs:restriction base="xs:string">
    <xs:enumeration value="" />
  </xs:restriction>
</xs:simpleType>

If you then declared the <foo> element with:

<xs:element name="foo" type="decimal-or-empty" />

then the following would be valid:

<foo>12.5</foo>
<foo />

Also you can define the above as below as well...
<SimpleType>
   <Union>
     <simpletype>
       for decimal
     </simpletype?
     <SimpleType>
      for string with empty value
     </simpletype?
   </union>
</simpletype>

Distributed Computing: A Guide to Comparing Data Between Hive Tables Using Spark

In big data, efficient data comparison is essential for ensuring data integrity and validating data migrations. Apache Spark, with its in-me...