forked from loafle/openapi-generator-original
b96334ffad
Supports: All OpenAPI 3.x data types: primitives, arrays, enums, nullable/optional fields, nested objects All parameter types: path, query, header, cookie, and combinations Schema composition: allOf (inheritance), oneOf (discriminated unions), anyOf (flexible unions) Security schemes: API key and bearer token authentication Discriminator-based polymorphic deserialization and error handling Provides: Error handling for invalid JSON, type mismatches, missing/unknown discriminator, and parameter validation Build system integration (CMake) for easy compilation and linking with required dependencies Clear build and run instructions for local development and testing Enables comprehensive, real-world validation of generated C++ server code against OpenAPI specifications
48 lines
1.0 KiB
C++
48 lines
1.0 KiB
C++
/**
|
|
* This file is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
* https://openapi-generator.tech
|
|
* Do not edit the class manually.
|
|
*/
|
|
|
|
#pragma once
|
|
// System headers
|
|
#include <nlohmann/json.hpp>
|
|
#include <string>
|
|
#include <vector>
|
|
#include "Employee.h"
|
|
|
|
|
|
|
|
namespace models {
|
|
|
|
|
|
class Department
|
|
{
|
|
public:
|
|
|
|
Department();
|
|
virtual ~Department() = default;
|
|
|
|
// Getters and setters
|
|
[[nodiscard]] std::string getName() const;
|
|
void setName(const std::string& name);
|
|
[[nodiscard]] Employee getManager() const;
|
|
void setManager(const Employee& manager);
|
|
[[nodiscard]] std::vector<Employee> getEmployees() const;
|
|
void setEmployees(const std::vector<Employee>& employees);
|
|
|
|
|
|
// JSON serialization using NLOHMANN INTRUSIVE macro (must be inside class to access private members)
|
|
NLOHMANN_DEFINE_TYPE_INTRUSIVE(Department,
|
|
name, manager, employees)
|
|
|
|
private:
|
|
std::string name;
|
|
Employee manager;
|
|
std::vector<Employee> employees;
|
|
};
|
|
|
|
|
|
} // namespace models
|
|
|