rct

package
v1.61.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2025 License: MIT Imports: 8 Imported by: 0

README

Package rct

Пакет rct предназначен для тестирования схемы и валидации удалённой конфигурации, используемой с isp-kit.

Functions

Test[T any](t *testing.T, defaultRemoteConfigPath string, remoteConfig T)

Проверяет, что удалённая конфигурация соответствует сгенерированной JSON-схеме и проходит валидацию.

  • Проверяет отсутствие устаревшего тега valid
  • Проверяет соответствие структуры JSON-схеме
  • Выполняет валидацию значений с помощью validator.Default
FindTag[T any](v T, tag string) bool

Рекурсивно проверяет, содержит ли структура тег с указанным именем.

Usage

Example usage in test
package mypkg_test

import (
	"testing"

	"github.com/txix-open/isp-kit/rct"
)

type RemoteCfg struct {
	Name string `json:"name" validate:"required"`
}

func TestRemoteCfg(t *testing.T) {
	rct.Test(t, "conf/default_remote_config.json", RemoteCfg{})
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindTag

func FindTag[T any](v T, tag string) bool

func Test

func Test[T any](t *testing.T, defaultRemoteConfigPath string, remoteConfig T)

nolint:lll

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL