apollo-language-server 0.7.0

A GraphQL language server with first-class support for Apollo Federation
Documentation
use once_cell::sync::Lazy;
use std::collections::HashMap;

use super::{Spec, SpecDirective, SpecStatus, SpecsByVersion};

pub const TAG_SPEC_NAME: &str = "tag";
pub const TAG_DIRECTIVE: &str = "tag";
pub const TAG_DESCRIPTION: &str = "The @tag directive applies arbitrary string metadata to a schema location. Custom tooling can use this metadata during any step of the schema delivery flow, including composition, static analysis, and documentation. The GraphOS Enterprise contracts feature uses @tag with its inclusion and exclusion filters.";

pub static TAG_SPECS_BY_VERSION: Lazy<SpecsByVersion> = {
    Lazy::new(|| {
        let tag_directive_v01: SpecDirective = SpecDirective::new(
"directive @tag(name: String!) repeatable on FIELD_DEFINITION | INTERFACE | OBJECT | UNION", TAG_DESCRIPTION
        );

        let tag_directive_v02 = SpecDirective::new(
            "directive @tag(name: String!) repeatable on FIELD_DEFINITION | INTERFACE | OBJECT | UNION | ARGUMENT_DEFINITION | SCALAR | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION", TAG_DESCRIPTION
        );

        let tag_directive_v03 = SpecDirective::new(
"directive @tag(name: String!) repeatable on FIELD_DEFINITION | INTERFACE | OBJECT | UNION | ARGUMENT_DEFINITION | SCALAR | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION | SCHEMA", TAG_DESCRIPTION);

        let mut tag_versions: SpecsByVersion = HashMap::new();

        let tag_spec_0_1 = Spec {
            status: SpecStatus::Deprecated,
            scalars: HashMap::new(),
            input_types: HashMap::new(),
            directives: HashMap::from([(TAG_DIRECTIVE.to_string(), tag_directive_v01)]),
            enums: HashMap::new(),
        };

        let tag_spec_0_2 = Spec {
            status: SpecStatus::Deprecated,
            scalars: HashMap::new(),
            input_types: HashMap::new(),
            directives: HashMap::from([(TAG_DIRECTIVE.to_string(), tag_directive_v02)]),
            enums: HashMap::new(),
        };

        let tag_spec_0_3 = Spec {
            status: SpecStatus::Supported,
            scalars: HashMap::new(),
            input_types: HashMap::new(),
            directives: HashMap::from([(TAG_DIRECTIVE.to_string(), tag_directive_v03)]),
            enums: HashMap::new(),
        };

        tag_versions.insert("0.1".to_string(), tag_spec_0_1);
        tag_versions.insert("0.2".to_string(), tag_spec_0_2);
        tag_versions.insert("0.3".to_string(), tag_spec_0_3);

        tag_versions
    })
};