This repository contains the nuget package MaLoIdentModels
which contains C# model classes with System.Text.Json
attributes for the Marktlokation Identification API by EDI@Energy.
It (de)serializes model classes to 100% as required by EDI@Energy (this includes datetimes and enums), but provides you as a developer with strongly typed models instead of stringly typed properties that you'd have to deal with, if you used the official OpenApi spec.
All the JSON serialization settings come out of the box, no manual settings required as long as you use System.Text.Json
.
Install it from nuget MaLoIdentModels:
dotnet add package MaLoIdentModels
Then use it
using MaLoIdentModels.v1;
// ...
var myNegativeResponse = new ResultNegative()
{
DecisionTree = "E_0594",
ResponseCode = "A10",
Reason = "Ich bin ein Freitext.",
NetworkOperator = 9900987654321
};
var myJson = System.Text.Json.JsonSerializer.Serialize(myNegativeResponse);
Console.Out.WriteLine(myJson);
For each major version of the OpenAPI spec, a new namespace is created.
The version which is valid from April 2025 onwards is v1
.
The classes are generally based on the MaLo Ident OpenAPI specification. But although auto-generation of code is theoretically possible, the classes are not autogenerated for multiple reasons:
- The official OpenAPI Spec has several problems. We at Hochfrequenz maintain a better version of the
openapi.yml
without all the shortcomings here: Hochfrequenz/malo-ident-python-models/openapi/openapi.yml - (Technical) We wanted to use System.Text.Json in .NET8 (and not Newtonsoft in .NET6) and did not find a a working code generator.
- We didn't want to deal with magic JsonSettings, so we manually added all JsonPropertyName attributes and JsonConverters where needed.
We also maintain a Python version of this data model.
You are very welcome to contribute to this template repository by opening a pull request against the main branch.
Hochfrequenz Unternehmensberatung GmbH is a consulting company with offices in Berlin, Leipzig, Köln and Bremen. We're not only the main contributor to open source in the field of German utilities but, according to Kununu ratings, also among the most attractive employers within the German energy market. Applications of talented developers are welcome at any time! Please consider visiting our career page (German only).