GunStoreIMS.Models
0.1.14
dotnet add package GunStoreIMS.Models --version 0.1.14
NuGet\Install-Package GunStoreIMS.Models -Version 0.1.14
<PackageReference Include="GunStoreIMS.Models" Version="0.1.14" />
<PackageVersion Include="GunStoreIMS.Models" Version="0.1.14" />
<PackageReference Include="GunStoreIMS.Models" />
paket add GunStoreIMS.Models --version 0.1.14
#r "nuget: GunStoreIMS.Models, 0.1.14"
#:package GunStoreIMS.Models@0.1.14
#addin nuget:?package=GunStoreIMS.Models&version=0.1.14
#tool nuget:?package=GunStoreIMS.Models&version=0.1.14
GunStoreIMS C# SDK
Production-ready C# models generated from the GunStoreIMS schema registry.
🚀 Enterprise-Grade CI/CD: Built on self-hosted infrastructure with deterministic builds, security scanning, and automated publishing. See Enterprise Architecture for details.
Features
✅ Immutable versioning – Pinned to registry version v0.1.2
✅ SHA-256 integrity checks – Every schema fetch is cryptographically verified
✅ System.Text.Json – Native JSON serialization support
✅ Nullable reference types – Full C# 8+ nullability annotations
✅ Source Link – Debug into the source via NuGet symbols
✅ Deterministic builds – Reproducible packages with embedded sources
✅ Security scanning – Weekly CodeQL analysis
Installation
dotnet add package GunStoreIMS.Models
Or via NuGet Package Manager:
Install-Package GunStoreIMS.Models
Usage
Basic Example
using System.Text.Json;
using GunStoreIMS.Models.Inventory.SerializedInventoryItem; // File-specific namespace
// Create an instance
var item = new Anonymous
{
// Set properties as defined in schema
// Note: Class name is "Anonymous" - generated from schema
};
// Serialize to JSON
var json = JsonSerializer.Serialize(item, new JsonSerializerOptions
{
WriteIndented = true
});
// Deserialize from JSON
var roundTrip = JsonSerializer.Deserialize<Anonymous>(json);
Getting Started: Understanding Namespaces
This SDK uses file-specific namespaces to avoid type collisions:
// ✅ Correct: Import the specific file's namespace
using GunStoreIMS.Models.Inventory.SerializedInventoryItem;
using GunStoreIMS.Models.Compliance.Form4473;
// The class name depends on the schema's "title" field
// Common class names: Anonymous, Anonymous2, or schema-specific titles
Pro Tip: Use Global Usings
Add to your project's GlobalUsings.cs for convenience:
// GlobalUsings.cs
global using GunStoreIMS.Models.Inventory.SerializedInventoryItem;
global using GunStoreIMS.Models.Compliance.Form4473;
global using GunStoreIMS.Models.Sales.Customer;
global using GunStoreIMS.Models.Party.Party;
// ... add your most-used namespaces
Complete Example: Inventory Management
using System.Text.Json;
using GunStoreIMS.Models.Inventory.Firearm;
// Create a firearm record
var firearm = new Anonymous
{
// Populate required fields from schema
};
// Serialize with System.Text.Json
var options = new JsonSerializerOptions
{
WriteIndented = true,
PropertyNameCaseInsensitive = true
};
var json = JsonSerializer.Serialize(firearm, options);
Console.WriteLine(json);
// Deserialize
var deserialized = JsonSerializer.Deserialize<Anonymous>(json, options);
Working with Enums
using GunStoreIMS.Models.Compliance.Form4473Status;
// Enums are strongly typed
var status = Form4473Status.Pending;
// JSON serialization handles enums automatically
var json = JsonSerializer.Serialize(status);
// Output: "Pending" (string in JSON)
Extension Data (Additional Properties)
Many models support additional properties via JsonExtensionData:
using System.Collections.Generic;
using System.Text.Json;
using GunStoreIMS.Models.Common.Address;
var jsonWithExtras = """
{
"street": "123 Main St",
"customField": "custom value"
}
""";
var address = JsonSerializer.Deserialize<Anonymous>(jsonWithExtras);
// Access extension data if the model supports it
// Check the generated code for IDictionary<string, object> properties
Discovering Available Types
Use reflection to explore generated types:
using System.Reflection;
var assembly = Assembly.Load("GunStoreIMS.Models");
var inventoryTypes = assembly.GetTypes()
.Where(t => t.Namespace?.StartsWith("GunStoreIMS.Models.Inventory") == true)
.ToList();
foreach (var type in inventoryTypes)
{
Console.WriteLine($"{type.Namespace}.{type.Name}");
}
Schema Version
This SDK is generated from schema registry version v0.1.2.
All schemas are fetched from:
https://schemas.gunstoreims.com/v0.1.2/
Development
Prerequisites
- .NET 8.0 SDK
- PowerShell 7+ (Windows) or Bash (Linux/macOS)
Generate Models from Registry
# Windows (PowerShell)
cd src/GunStoreIMS.Models/CodeGen
./fetch-and-generate.ps1
# Linux/macOS (Bash)
cd src/GunStoreIMS.Models/CodeGen
chmod +x fetch-and-generate.sh
./fetch-and-generate.sh
Build & Pack
dotnet restore
dotnet build -c Release
dotnet pack -c Release -o ./artifacts
Run Tests
dotnet test -c Release
Architecture
gunstoreims-csharp-sdk/
├─ src/
│ └─ GunStoreIMS.Models/
│ ├─ GunStoreIMS.Models.csproj
│ ├─ CodeGen/ # Code generation scripts & config
│ │ ├─ codegen.settings.json # NJsonSchema generator settings
│ │ ├─ schema-sources.json # List of schemas to generate
│ │ ├─ fetch-and-generate.ps1 # Windows generation script
│ │ └─ fetch-and-generate.sh # Linux/macOS generation script
│ ├─ Generated/ # Generated C# POCOs (committed)
│ └─ GlobalUsings.cs
├─ Directory.Build.props # Schema version & package config
├─ Directory.Packages.props # Central package management
└─ .github/workflows/ci.yml # CI/CD pipeline
Schema Governance
This SDK is read-only and immutable:
- Source of truth:
gunstoreims-schemasrepository - Version pinning: Each SDK release maps to a specific schema version (e.g.,
v0.1.2) - Integrity verification: SHA-256 checksums ensure no tampering
To update schemas:
- Modify schemas in the
gunstoreims-schemasrepository - Publish new registry version (e.g.,
v0.1.3) - Update
<SchemaVersion>inDirectory.Build.props - Re-run code generation
- Publish new SDK version
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This SDK is licensed under the MIT License.
Documentation & Policies
- 📖 API Documentation (GitHub Pages)
- 🏗️ Enterprise Architecture - CI/CD pipeline details
- 🔒 Security Policy - Vulnerability reporting & compliance
- 📋 Changelog - Version history & release notes
- 🚀 Quick Reference - Code examples & patterns
Related Projects
- gunstoreims-schemas – JSON Schema registry (source of truth)
- GunStoreIMS.API – REST API implementation
- gunstoreims-ts-sdk – TypeScript SDK
Support
- 📖 Documentation
- 💬 Discussions
- 🐛 Issue Tracker
- 🔐 Security Reports - security@gunstoreims.com
Built with ❤️ by the GunStoreIMS team
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- NJsonSchema (>= 11.0.0)
- NJsonSchema.CodeGeneration.CSharp (>= 11.0.0)
- System.Net.Http (>= 4.3.4)
- System.Text.RegularExpressions (>= 4.3.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.14 | 4,571 | 11/11/2025 |