riskfirst / riskfirst.hateoas

Powerful HATEOAS functionality for .NET web api
MIT License
78 stars 25 forks source link

XML serialization now works. #26

Closed dnikolovv closed 5 years ago

dnikolovv commented 5 years ago

The JSON serialization logic remains unchanged.

The XML format used is this one (note that the "controller details" are lost while serializing to XML and the link name is put inside the rel attribute).

<?xml version="1.0"?>
<ItemsLinkContainerOfValueInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <link href="http://localhost/api/Values" method="GET" rel="self"/>
  <link href="http://localhost/api/Values" method="POST" rel="insert"/>
  <Items>
    <ValueInfo>
      <link href="http://localhost/api/Values/1" method="GET" rel="self"/>
      <Id>1</Id>
      <Value>Value One</Value>
    </ValueInfo>
    <ValueInfo>
      <link href="http://localhost/api/Values/2" method="GET" rel="self"/>
      <Id>2</Id>
      <Value>Value Two</Value>
    </ValueInfo>
    <ValueInfo>
      <link href="http://localhost/api/Values/3" method="GET" rel="self"/>
      <Id>3</Id>
      <Value>Value Three</Value>
    </ValueInfo>
  </Items>
</ItemsLinkContainerOfValueInfo>

Closes https://github.com/riskfirst/riskfirst.hateoas/issues/17 and https://github.com/riskfirst/riskfirst.hateoas/issues/25.

jamiecoh commented 5 years ago

This is looking good. Do you think this is a minor or Major version change (Is it entirely backward compatible?)

dnikolovv commented 5 years ago

Well, I tried my best to make it entirely backward compatible. All tests are passing and the APIs have remained the same. I don't think it's a major version change.